Skip to content

Commit

Permalink
Fix function type declaration of _run property
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian-hiller committed Sep 20, 2024
1 parent 59074a2 commit 6e5b6ec
Show file tree
Hide file tree
Showing 15 changed files with 97 additions and 130 deletions.
4 changes: 4 additions & 0 deletions library/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to the library will be documented in this file.

## vX.X.X (Month DD, YYYY)

- Fix function type declaration of `_run` property

## v0.42.0 (September 15, 2024)

- Add `metadata` action to add custom metadata to a schema
Expand Down
2 changes: 1 addition & 1 deletion library/src/methods/fallback/fallbackAsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export type SchemaWithFallbackAsync<
*/
readonly _run: (
dataset: Dataset<unknown, never>,
config: Config<InferIssue<TSchema>>
config: Config<BaseIssue<unknown>>
) => Promise<Dataset<InferOutput<TSchema>, InferIssue<TSchema>>>;
};

Expand Down
56 changes: 18 additions & 38 deletions library/src/methods/omit/omit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,10 @@ export type SchemaWithOmit<
*
* @internal
*/
_run(
readonly _run: (
dataset: Dataset<unknown, never>,
config: Config<
| Extract<InferIssue<TSchema>, { type: TSchema['type'] }>
| InferObjectIssue<Omit<TEntries, TKeys[number]>>
>
): Dataset<
config: Config<BaseIssue<unknown>>
) => Dataset<
InferObjectOutput<Omit<TEntries, TKeys[number]>>,
| Extract<InferIssue<TSchema>, { type: TSchema['type'] }>
| InferObjectIssue<Omit<TEntries, TKeys[number]>>
Expand Down Expand Up @@ -138,13 +135,10 @@ export type SchemaWithOmit<
*
* @internal
*/
_run(
readonly _run: (
dataset: Dataset<unknown, never>,
config: Config<
| Extract<InferIssue<TSchema>, { type: TSchema['type'] }>
| InferObjectIssue<Omit<TEntries, TKeys[number]>>
>
): Promise<
config: Config<BaseIssue<unknown>>
) => Promise<
Dataset<
InferObjectOutput<Omit<TEntries, TKeys[number]>>,
| Extract<InferIssue<TSchema>, { type: TSchema['type'] }>
Expand Down Expand Up @@ -183,13 +177,10 @@ export type SchemaWithOmit<
*
* @internal
*/
_run(
readonly _run: (
dataset: Dataset<unknown, never>,
config: Config<
| Extract<InferIssue<TSchema>, { type: TSchema['type'] }>
| InferObjectIssue<Omit<TEntries, TKeys[number]>>
>
): Dataset<
config: Config<BaseIssue<unknown>>
) => Dataset<
InferObjectOutput<Omit<TEntries, TKeys[number]>> & {
[key: string]: unknown;
},
Expand Down Expand Up @@ -234,13 +225,10 @@ export type SchemaWithOmit<
*
* @internal
*/
_run(
readonly _run: (
dataset: Dataset<unknown, never>,
config: Config<
| Extract<InferIssue<TSchema>, { type: TSchema['type'] }>
| InferObjectIssue<Omit<TEntries, TKeys[number]>>
>
): Promise<
config: Config<BaseIssue<unknown>>
) => Promise<
Dataset<
InferObjectOutput<Omit<TEntries, TKeys[number]>> & {
[key: string]: unknown;
Expand Down Expand Up @@ -290,14 +278,10 @@ export type SchemaWithOmit<
*
* @internal
*/
_run(
readonly _run: (
dataset: Dataset<unknown, never>,
config: Config<
| Extract<InferIssue<TSchema>, { type: TSchema['type'] }>
| InferObjectIssue<Omit<TEntries, TKeys[number]>>
| InferIssue<TSchema['rest']>
>
): Dataset<
config: Config<BaseIssue<unknown>>
) => Dataset<
InferObjectOutput<Omit<TEntries, TKeys[number]>> & {
[key: string]: InferOutput<TSchema['rest']>;
},
Expand Down Expand Up @@ -345,14 +329,10 @@ export type SchemaWithOmit<
*
* @internal
*/
_run(
readonly _run: (
dataset: Dataset<unknown, never>,
config: Config<
| Extract<InferIssue<TSchema>, { type: TSchema['type'] }>
| InferObjectIssue<Omit<TEntries, TKeys[number]>>
| InferIssue<TSchema['rest']>
>
): Promise<
config: Config<BaseIssue<unknown>>
) => Promise<
Dataset<
InferObjectOutput<Omit<TEntries, TKeys[number]>> & {
[key: string]: InferOutput<TSchema['rest']>;
Expand Down
18 changes: 9 additions & 9 deletions library/src/methods/partial/partial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ export type SchemaWithPartial<
*
* @internal
*/
_run(
readonly _run: (
dataset: Dataset<unknown, never>,
config: Config<InferIssue<TSchema>>
): Dataset<
config: Config<BaseIssue<unknown>>
) => Dataset<
InferObjectOutput<PartialEntries<TEntries, TKeys>>,
InferIssue<TSchema>
>;
Expand Down Expand Up @@ -121,10 +121,10 @@ export type SchemaWithPartial<
*
* @internal
*/
_run(
readonly _run: (
dataset: Dataset<unknown, never>,
config: Config<InferIssue<TSchema>>
): Dataset<
config: Config<BaseIssue<unknown>>
) => Dataset<
InferObjectOutput<PartialEntries<TEntries, TKeys>> & {
[key: string]: unknown;
},
Expand Down Expand Up @@ -167,10 +167,10 @@ export type SchemaWithPartial<
*
* @internal
*/
_run(
readonly _run: (
dataset: Dataset<unknown, never>,
config: Config<InferIssue<TSchema>>
): Dataset<
config: Config<BaseIssue<unknown>>
) => Dataset<
InferObjectOutput<PartialEntries<TEntries, TKeys>> & {
[key: string]: InferOutput<TRest>;
},
Expand Down
18 changes: 9 additions & 9 deletions library/src/methods/partial/partialAsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ export type SchemaWithPartialAsync<
*
* @internal
*/
_run(
readonly _run: (
dataset: Dataset<unknown, never>,
config: Config<InferIssue<TSchema>>
): Promise<
config: Config<BaseIssue<unknown>>
) => Promise<
Dataset<
InferObjectOutput<PartialEntries<TEntries, TKeys>>,
InferIssue<TSchema>
Expand Down Expand Up @@ -128,10 +128,10 @@ export type SchemaWithPartialAsync<
*
* @internal
*/
_run(
readonly _run: (
dataset: Dataset<unknown, never>,
config: Config<InferIssue<TSchema>>
): Promise<
config: Config<BaseIssue<unknown>>
) => Promise<
Dataset<
InferObjectOutput<PartialEntries<TEntries, TKeys>> & {
[key: string]: unknown;
Expand Down Expand Up @@ -176,10 +176,10 @@ export type SchemaWithPartialAsync<
*
* @internal
*/
_run(
readonly _run: (
dataset: Dataset<unknown, never>,
config: Config<InferIssue<TSchema>>
): Promise<
config: Config<BaseIssue<unknown>>
) => Promise<
Dataset<
InferObjectOutput<PartialEntries<TEntries, TKeys>> & {
[key: string]: InferOutput<TRest>;
Expand Down
56 changes: 18 additions & 38 deletions library/src/methods/pick/pick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,10 @@ export type SchemaWithPick<
*
* @internal
*/
_run(
readonly _run: (
dataset: Dataset<unknown, never>,
config: Config<
| Extract<InferIssue<TSchema>, { type: TSchema['type'] }>
| InferObjectIssue<Pick<TEntries, TKeys[number]>>
>
): Dataset<
config: Config<BaseIssue<unknown>>
) => Dataset<
InferObjectOutput<Pick<TEntries, TKeys[number]>>,
| Extract<InferIssue<TSchema>, { type: TSchema['type'] }>
| InferObjectIssue<Pick<TEntries, TKeys[number]>>
Expand Down Expand Up @@ -138,13 +135,10 @@ export type SchemaWithPick<
*
* @internal
*/
_run(
readonly _run: (
dataset: Dataset<unknown, never>,
config: Config<
| Extract<InferIssue<TSchema>, { type: TSchema['type'] }>
| InferObjectIssue<Pick<TEntries, TKeys[number]>>
>
): Promise<
config: Config<BaseIssue<unknown>>
) => Promise<
Dataset<
InferObjectOutput<Pick<TEntries, TKeys[number]>>,
| Extract<InferIssue<TSchema>, { type: TSchema['type'] }>
Expand Down Expand Up @@ -183,13 +177,10 @@ export type SchemaWithPick<
*
* @internal
*/
_run(
readonly _run: (
dataset: Dataset<unknown, never>,
config: Config<
| Extract<InferIssue<TSchema>, { type: TSchema['type'] }>
| InferObjectIssue<Pick<TEntries, TKeys[number]>>
>
): Dataset<
config: Config<BaseIssue<unknown>>
) => Dataset<
InferObjectOutput<Pick<TEntries, TKeys[number]>> & {
[key: string]: unknown;
},
Expand Down Expand Up @@ -234,13 +225,10 @@ export type SchemaWithPick<
*
* @internal
*/
_run(
readonly _run: (
dataset: Dataset<unknown, never>,
config: Config<
| Extract<InferIssue<TSchema>, { type: TSchema['type'] }>
| InferObjectIssue<Pick<TEntries, TKeys[number]>>
>
): Promise<
config: Config<BaseIssue<unknown>>
) => Promise<
Dataset<
InferObjectOutput<Pick<TEntries, TKeys[number]>> & {
[key: string]: unknown;
Expand Down Expand Up @@ -290,14 +278,10 @@ export type SchemaWithPick<
*
* @internal
*/
_run(
readonly _run: (
dataset: Dataset<unknown, never>,
config: Config<
| Extract<InferIssue<TSchema>, { type: TSchema['type'] }>
| InferObjectIssue<Pick<TEntries, TKeys[number]>>
| InferIssue<TSchema['rest']>
>
): Dataset<
config: Config<BaseIssue<unknown>>
) => Dataset<
InferObjectOutput<Pick<TEntries, TKeys[number]>> & {
[key: string]: InferOutput<TSchema['rest']>;
},
Expand Down Expand Up @@ -345,14 +329,10 @@ export type SchemaWithPick<
*
* @internal
*/
_run(
readonly _run: (
dataset: Dataset<unknown, never>,
config: Config<
| Extract<InferIssue<TSchema>, { type: TSchema['type'] }>
| InferObjectIssue<Pick<TEntries, TKeys[number]>>
| InferIssue<TSchema['rest']>
>
): Promise<
config: Config<BaseIssue<unknown>>
) => Promise<
Dataset<
InferObjectOutput<Pick<TEntries, TKeys[number]>> & {
[key: string]: InferOutput<TSchema['rest']>;
Expand Down
2 changes: 1 addition & 1 deletion library/src/methods/pipe/pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export type SchemaWithPipe<
*/
readonly _run: (
dataset: Dataset<unknown, never>,
config: Config<InferIssue<FirstTupleItem<TPipe>>>
config: Config<BaseIssue<unknown>>
) => Dataset<InferOutput<LastTupleItem<TPipe>>, InferIssue<TPipe[number]>>;
/**
* Input, output and issue type.
Expand Down
2 changes: 1 addition & 1 deletion library/src/methods/pipe/pipeAsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export type SchemaWithPipeAsync<
*/
readonly _run: (
dataset: Dataset<unknown, never>,
config: Config<InferIssue<FirstTupleItem<TPipe>>>
config: Config<BaseIssue<unknown>>
) => Promise<
Dataset<InferOutput<LastTupleItem<TPipe>>, InferIssue<TPipe[number]>>
>;
Expand Down
18 changes: 9 additions & 9 deletions library/src/methods/required/required.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ export type SchemaWithRequired<
*
* @internal
*/
_run(
readonly _run: (
dataset: Dataset<unknown, never>,
config: Config<InferIssue<TSchema>>
): Dataset<
config: Config<BaseIssue<unknown>>
) => Dataset<
InferObjectOutput<RequiredEntries<TEntries, TKeys, TMessage>>,
NonOptionalIssue | InferIssue<TSchema>
>;
Expand Down Expand Up @@ -128,10 +128,10 @@ export type SchemaWithRequired<
*
* @internal
*/
_run(
readonly _run: (
dataset: Dataset<unknown, never>,
config: Config<InferIssue<TSchema>>
): Dataset<
config: Config<BaseIssue<unknown>>
) => Dataset<
InferObjectOutput<RequiredEntries<TEntries, TKeys, TMessage>> & {
[key: string]: unknown;
},
Expand Down Expand Up @@ -176,10 +176,10 @@ export type SchemaWithRequired<
*
* @internal
*/
_run(
readonly _run: (
dataset: Dataset<unknown, never>,
config: Config<InferIssue<TSchema>>
): Dataset<
config: Config<BaseIssue<unknown>>
) => Dataset<
InferObjectOutput<RequiredEntries<TEntries, TKeys, TMessage>> & {
[key: string]: InferOutput<TRest>;
},
Expand Down
Loading

0 comments on commit 6e5b6ec

Please sign in to comment.