Skip to content

Commit 5c0aebe

Browse files
committed
refactor: improve more type signatures
- inherited(base) now typed as T.class_of(Plugin) instead of T.untyped - raw_hash now typed as T::Hash[String, T.untyped] since YAML produces string keys
1 parent 11af879 commit 5c0aebe

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

lib/code_teams.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def self.from_yml(config_yml)
8585
)
8686
end
8787

88-
sig { params(raw_hash: T::Hash[T.untyped, T.untyped]).returns(Team) }
88+
sig { params(raw_hash: T::Hash[String, T.untyped]).returns(Team) }
8989
def self.from_hash(raw_hash)
9090
new(
9191
config_yml: nil,
@@ -104,7 +104,7 @@ def self.register_plugins
104104
end
105105
end
106106

107-
sig { returns(T::Hash[T.untyped, T.untyped]) }
107+
sig { returns(T::Hash[String, T.untyped]) }
108108
attr_reader :raw_hash
109109

110110
sig { returns(T.nilable(String)) }
@@ -113,7 +113,7 @@ def self.register_plugins
113113
sig do
114114
params(
115115
config_yml: T.nilable(String),
116-
raw_hash: T::Hash[T.untyped, T.untyped]
116+
raw_hash: T::Hash[String, T.untyped]
117117
).void
118118
end
119119
def initialize(config_yml:, raw_hash:)

lib/code_teams/plugin.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ def self.default_data_accessor_name
2828
Utils.underscore(Utils.demodulize(T.must(name)))
2929
end
3030

31-
sig { params(base: T.untyped).void }
31+
sig { params(base: T.class_of(Plugin)).void }
3232
def self.inherited(base) # rubocop:disable Lint/MissingSuper
33-
all_plugins << T.cast(base, T.class_of(Plugin))
33+
all_plugins << base
3434
end
3535

3636
sig { returns(T::Array[T.class_of(Plugin)]) }

0 commit comments

Comments
 (0)