Skip to content

Commit

Permalink
fix(deserializer): handle inference of omitted deserializer properties
Browse files Browse the repository at this point in the history
  • Loading branch information
DASPRiD committed Apr 28, 2024
1 parent ca55539 commit 6c8793b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/deserializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,29 +89,36 @@ export type InferType<T> = T extends ResourceDeserializer<
>
? U
: never;
type IsUndefined<T> = undefined extends T ? true : false;
export type InferAttributesSchema<T> = T extends ResourceDeserializer<
string,
infer U,
Relationships | undefined,
MetaSchema | undefined
>
? U
? IsUndefined<U> extends true
? undefined
: U
: never;
export type InferRelationships<T> = T extends ResourceDeserializer<
string,
AttributesSchema | undefined,
infer U,
MetaSchema | undefined
>
? U
? IsUndefined<U> extends true
? undefined
: U
: never;
export type InferDocumentMetaSchema<T> = T extends ResourceDeserializer<
string,
AttributesSchema | undefined,
Relationships | undefined,
infer U
>
? U
? IsUndefined<U> extends true
? undefined
: U
: never;

type IncludeResult<TDeserializer extends AnyRelationshipDeserializer> =
Expand Down

0 comments on commit 6c8793b

Please sign in to comment.