File tree Expand file tree Collapse file tree 3 files changed +15
-9
lines changed Expand file tree Collapse file tree 3 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -116,11 +116,14 @@ def coerce(value, state:)
116
116
#
117
117
# @return [Object]
118
118
def to_sorbet_type
119
- case values
119
+ types = values . map { OpenAI ::Internal ::Util ::SorbetRuntimeSupport . to_sorbet_type ( _1 ) } . uniq
120
+ case types
120
121
in [ ]
121
122
T . noreturn
122
- in [ value , *_ ]
123
- T . all ( OpenAI ::Internal ::Util ::SorbetRuntimeSupport . to_sorbet_type ( value ) , self )
123
+ in [ type ]
124
+ type
125
+ else
126
+ T . any ( *types )
124
127
end
125
128
end
126
129
Original file line number Diff line number Diff line change @@ -220,11 +220,14 @@ def dump(value, state:)
220
220
#
221
221
# @return [Object]
222
222
def to_sorbet_type
223
- case ( v = variants )
223
+ types = variants . map { OpenAI ::Internal ::Util ::SorbetRuntimeSupport . to_sorbet_type ( _1 ) } . uniq
224
+ case types
224
225
in [ ]
225
226
T . noreturn
227
+ in [ type ]
228
+ type
226
229
else
227
- T . any ( *v . map { OpenAI :: Internal :: Util :: SorbetRuntimeSupport . to_sorbet_type ( _1 ) } )
230
+ T . any ( *types )
228
231
end
229
232
end
230
233
Original file line number Diff line number Diff line change @@ -11,16 +11,16 @@ module OpenAI
11
11
mod . constants . each do |name |
12
12
case mod . const_get ( name )
13
13
in true | false
14
- mod . define_sorbet_constant! ( :TaggedBoolean ) { T . type_alias { T . all ( T ::Boolean , mod ) } }
14
+ mod . define_sorbet_constant! ( :TaggedBoolean ) { T . type_alias { T ::Boolean } }
15
15
mod . define_sorbet_constant! ( :OrBoolean ) { T . type_alias { T ::Boolean } }
16
16
in Integer
17
- mod . define_sorbet_constant! ( :TaggedInteger ) { T . type_alias { T . all ( Integer , mod ) } }
17
+ mod . define_sorbet_constant! ( :TaggedInteger ) { T . type_alias { Integer } }
18
18
mod . define_sorbet_constant! ( :OrInteger ) { T . type_alias { Integer } }
19
19
in Float
20
- mod . define_sorbet_constant! ( :TaggedFloat ) { T . type_alias { T . all ( Float , mod ) } }
20
+ mod . define_sorbet_constant! ( :TaggedFloat ) { T . type_alias { Float } }
21
21
mod . define_sorbet_constant! ( :OrFloat ) { T . type_alias { Float } }
22
22
in Symbol
23
- mod . define_sorbet_constant! ( :TaggedSymbol ) { T . type_alias { T . all ( Symbol , mod ) } }
23
+ mod . define_sorbet_constant! ( :TaggedSymbol ) { T . type_alias { Symbol } }
24
24
mod . define_sorbet_constant! ( :OrSymbol ) { T . type_alias { T . any ( Symbol , String ) } }
25
25
else
26
26
end
You can’t perform that action at this time.
0 commit comments