Skip to content

Commit

Permalink
Fix object output type for optional with pipe #944
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian-hiller committed Nov 28, 2024
1 parent c2d945a commit 2704ce3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions library/src/types/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import type {
import type { InferInput, InferIssue, InferOutput } from './infer.ts';
import type { BaseIssue } from './issue.ts';
import type { ErrorMessage } from './other.ts';
import type { SchemaWithoutPipe } from './pipe.ts';
import type { BaseSchema, BaseSchemaAsync } from './schema.ts';
import type { MarkOptional, MaybeReadonly, Prettify } from './utils.ts';

Expand Down Expand Up @@ -123,8 +124,8 @@ type ExactOptionalOutput<
| BaseSchema<unknown, unknown, BaseIssue<unknown>>
| BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>,
> = TSchema extends
| OptionalSchema<infer TWrapped, unknown>
| OptionalSchemaAsync<infer TWrapped, unknown>
| SchemaWithoutPipe<OptionalSchema<infer TWrapped, unknown>>
| SchemaWithoutPipe<OptionalSchemaAsync<infer TWrapped, unknown>>
? HasDefault<TSchema> extends true
? InferOutput<TSchema>
: ExactOptionalOutput<TWrapped>
Expand Down

0 comments on commit 2704ce3

Please sign in to comment.