@@ -108,7 +108,7 @@ export function schemaToType(
108108 const schemaItems =
109109 schemaObject . allOf || schemaObject . oneOf || schemaObject . anyOf || [ ] ;
110110
111- const union = 'allOf' in schemaObject ;
111+ const intersect = 'allOf' in schemaObject ;
112112
113113 const types = schemaItems
114114 . map ( ( schema ) =>
@@ -144,11 +144,11 @@ export function schemaToType(
144144 return {
145145 name,
146146 hasQuestionToken,
147- type : union
147+ type : intersect
148148 ? // @ts -expect-error -> bad type in ts-morph (arguably)
149- Writers . unionType ( ...types , 'null' )
149+ Writers . intersectionType ( ...types , 'null' )
150150 : // @ts -expect-error -> bad type in ts-morph (arguably)
151- Writers . intersectionType ( ...types , 'null' ) ,
151+ Writers . unionType ( ...types , 'null' ) ,
152152 } ;
153153 }
154154
@@ -229,7 +229,7 @@ export function registerTypesFromSchema(
229229 const schemaItems =
230230 schemaObject . allOf || schemaObject . oneOf || schemaObject . anyOf || [ ] ;
231231
232- const union = 'allOf' in schemaObject ;
232+ const intersect = 'allOf' in schemaObject ;
233233
234234 const typeAliases = schemaItems . filter ( isReferenceObject ) . map ( ( s ) => {
235235 const alias = typesAndInterfaces . get ( s . $ref ) ;
@@ -255,7 +255,7 @@ export function registerTypesFromSchema(
255255 } ) ,
256256 ) ;
257257
258- const writerType = union
258+ const writerType = intersect
259259 ? Writers . intersectionType . bind ( Writers )
260260 : Writers . unionType . bind ( Writers ) ;
261261
0 commit comments