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:)
116116 #
117117 # @return [Object]
118118 def to_sorbet_type
119- case values
119+ types = values . map { OpenAI ::Internal ::Util ::SorbetRuntimeSupport . to_sorbet_type ( _1 ) } . uniq
120+ case types
120121 in [ ]
121122 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 )
124127 end
125128 end
126129
Original file line number Diff line number Diff line change @@ -220,11 +220,14 @@ def dump(value, state:)
220220 #
221221 # @return [Object]
222222 def to_sorbet_type
223- case ( v = variants )
223+ types = variants . map { OpenAI ::Internal ::Util ::SorbetRuntimeSupport . to_sorbet_type ( _1 ) } . uniq
224+ case types
224225 in [ ]
225226 T . noreturn
227+ in [ type ]
228+ type
226229 else
227- T . any ( *v . map { OpenAI :: Internal :: Util :: SorbetRuntimeSupport . to_sorbet_type ( _1 ) } )
230+ T . any ( *types )
228231 end
229232 end
230233
Original file line number Diff line number Diff line change @@ -11,16 +11,16 @@ module OpenAI
1111 mod . constants . each do |name |
1212 case mod . const_get ( name )
1313 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 } }
1515 mod . define_sorbet_constant! ( :OrBoolean ) { T . type_alias { T ::Boolean } }
1616 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 } }
1818 mod . define_sorbet_constant! ( :OrInteger ) { T . type_alias { Integer } }
1919 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 } }
2121 mod . define_sorbet_constant! ( :OrFloat ) { T . type_alias { Float } }
2222 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 } }
2424 mod . define_sorbet_constant! ( :OrSymbol ) { T . type_alias { T . any ( Symbol , String ) } }
2525 else
2626 end
You can’t perform that action at this time.
0 commit comments