File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed
codegen-core/src/bindings
openapi-ts/src/plugins/@hey-api/typescript Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -55,8 +55,6 @@ export const createBinding = ({
55
55
if ( symbol . meta ?. kind === 'type' ) {
56
56
typeNames . push ( name ) ;
57
57
}
58
- // For 'value-and-type' kind (JavaScript enums), we don't add to typeNames
59
- // so they won't be exported as type-only
60
58
}
61
59
// cast type names to names to allow for cleaner API,
62
60
// otherwise users would have to define the same values twice
Original file line number Diff line number Diff line change @@ -130,9 +130,6 @@ export const exportType = ({
130
130
objectType : typeofType ,
131
131
} ) ,
132
132
} ) ;
133
-
134
- // Mark this symbol as containing both value and type
135
- symbol . meta = { ...symbol . meta , kind : 'value-and-type' } ;
136
133
plugin . setSymbolValue ( symbol , [ objectNode , node ] ) ;
137
134
return ;
138
135
} else if (
Original file line number Diff line number Diff line change @@ -497,10 +497,17 @@ const handleComponent = ({
497
497
schema : IR . SchemaObject ;
498
498
} ) => {
499
499
const type = schemaToType ( { plugin, schema } ) ;
500
+
501
+ // Don't tag JavaScript enums as 'type' since they export both values and types
502
+ const isJavaScriptEnum =
503
+ schema . type === 'enum' &&
504
+ plugin . config . enums . enabled &&
505
+ plugin . config . enums . mode === 'javascript' ;
506
+
500
507
const symbol = plugin . registerSymbol ( {
501
508
exported : true ,
502
509
meta : {
503
- kind : 'type' ,
510
+ kind : isJavaScriptEnum ? undefined : 'type' ,
504
511
} ,
505
512
name : buildName ( {
506
513
config : plugin . config . definitions ,
You can’t perform that action at this time.
0 commit comments