Skip to content

Commit 10f301c

Browse files
committed
feat: expose type infererence utils
1 parent 2b15f11 commit 10f301c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/vee-validate/src/types/forms.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ export interface TypedSchema<TInput = any, TOutput = TInput> {
2020
cast?(values: Partial<TInput>): TInput;
2121
}
2222

23+
export type InferOutput<TSchema extends TypedSchema> = TSchema extends TypedSchema<any, infer TOutput>
24+
? TOutput
25+
: never;
26+
27+
export type InferInput<TSchema extends TypedSchema> = TSchema extends TypedSchema<infer TInput, any> ? TInput : never;
28+
2329
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2430
export type YupSchema<TValues = any> = {
2531
__isYupSchema__: boolean;

0 commit comments

Comments
 (0)