Skip to content

Commit 6aae28f

Browse files
committed
Fix: handling useImplementingTypes and defaultNullableToNull at the same time
1 parent 87b3d13 commit 6aae28f

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/index.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -371,14 +371,17 @@ const getNamedType = (opts: Options<NamedTypeNode | ObjectTypeDefinitionNode>):
371371
)
372372
break;
373373

374-
return foundTypes
375-
.map((implementType: TypeItem) =>
376-
getNamedImplementType({
377-
...opts,
378-
currentType: implementType.types,
379-
}),
380-
)
381-
.join(' || ');
374+
return (
375+
foundTypes
376+
.map((implementType: TypeItem) =>
377+
getNamedImplementType({
378+
...opts,
379+
currentType: implementType.types,
380+
}),
381+
)
382+
.filter((value) => value !== null)
383+
.join(' || ') || null
384+
);
382385
default:
383386
throw `foundType is unknown: ${foundType.name}: ${foundType.type}`;
384387
}

0 commit comments

Comments
 (0)