Skip to content

Commit

Permalink
feat(zchema): added InferOr type
Browse files Browse the repository at this point in the history
  • Loading branch information
kedrzu committed Jan 10, 2025
1 parent c1c2716 commit 051bd1a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/zchema/src/Schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ export type InferNonNull<TSchema extends SchemaAny> =
// eslint-disable-next-line @typescript-eslint/no-explicit-any
TSchema extends Schema<infer V, any> ? V : never;

export type InferOr<TSchema, T = undefined> = TSchema extends Schema ? Infer<TSchema> : T;

export type Infer<TSchema extends SchemaAny> =
// eslint-disable-next-line @typescript-eslint/no-explicit-any
TSchema extends Schema<infer V, any>
Expand Down

0 comments on commit 051bd1a

Please sign in to comment.