File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -88,11 +88,11 @@ function determineType(
8888
8989 switch ( typeof value ) {
9090 case 'string' :
91- return options . unionNull ? 'string' : 'string' ;
91+ return 'string' ;
9292 case 'number' :
93- return options . unionNull ? 'number' : 'number' ;
93+ return 'number' ;
9494 case 'boolean' :
95- return options . unionNull ? 'boolean' : 'boolean' ;
95+ return 'boolean' ;
9696 case 'object' :
9797 if ( Array . isArray ( value ) ) {
9898 if ( value . length === 0 ) {
@@ -232,8 +232,8 @@ function generateTypeScriptCode(
232232
233233 // Add properties
234234 for ( const prop of interfaceData . properties ) {
235- const nullUnion = options . unionNull && prop . type === 'null' ? ' null' : '' ;
236- const typeWithNull = nullUnion ? ` ${ prop . type } | ${ nullUnion } ` : prop . type ;
235+ // Don't add null union for properties that are already null type
236+ const typeWithNull = prop . type ;
237237 const optionalIndicator = prop . isOptional ? '?' : '' ;
238238
239239 code += ` ${ prop . name } ${ optionalIndicator } : ${ typeWithNull } ;\n` ;
You can’t perform that action at this time.
0 commit comments