Skip to content

Commit

Permalink
Fix Default type for nullable, nullish and optional #593
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian-hiller committed May 24, 2024
1 parent 2a15452 commit 62b5e09
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions library/src/types/other.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type { Dataset } from './dataset.ts';
import type { InferInput, InferIssue } from './infer.ts';
import type { BaseIssue } from './issue.ts';
import type { BaseSchema, BaseSchemaAsync } from './schema.ts';
import type { MaybePromise } from './utils.ts';
import type { MaybePromise, MaybeReadonly } from './utils.ts';

/**
* Error message type.
Expand All @@ -38,12 +38,11 @@ export type Default<
TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>>,
TInput extends null | undefined,
> =
| InferInput<TWrapped>
| TInput
| MaybeReadonly<InferInput<TWrapped> | TInput>
| ((
dataset?: Dataset<TInput, never>,
config?: Config<InferIssue<TWrapped>>
) => InferInput<TWrapped> | TInput);
) => MaybeReadonly<InferInput<TWrapped> | TInput>);

/**
* Default async type.
Expand All @@ -54,12 +53,11 @@ export type DefaultAsync<
| BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>,
TInput extends null | undefined,
> =
| InferInput<TWrapped>
| TInput
| MaybeReadonly<InferInput<TWrapped> | TInput>
| ((
dataset?: Dataset<TInput, never>,
config?: Config<InferIssue<TWrapped>>
) => MaybePromise<InferInput<TWrapped> | TInput>);
) => MaybePromise<MaybeReadonly<InferInput<TWrapped> | TInput>>);

/**
* Default value type.
Expand Down

0 comments on commit 62b5e09

Please sign in to comment.