Skip to content

Commit d5c1ea7

Browse files
committed
fix(json-api-nestjs-shared): refine RelationCheck type logic to handle nested promises and exclude undefined types
1 parent 9ed78db commit d5c1ea7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libs/json-api/json-api-nestjs-shared/src/lib/types/entity-type.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ export type CastIteratorType<T> = T extends {
1313
type RelationCheck<T, IdKey extends string> = T extends never
1414
? 0
1515
: T extends Promise<infer U>
16-
? HasId<U, IdKey>
17-
: HasId<CastIteratorType<T>, IdKey>;
16+
? RelationCheck<U, IdKey>
17+
: HasId<Exclude<CastIteratorType<T>, undefined>, IdKey>;
1818

1919
export type RelationKeys<E, IdKey extends string = 'id'> = {
2020
[K in keyof E]: Exclude<E[K], null> extends never

0 commit comments

Comments
 (0)