Skip to content

Commit afc9bf5

Browse files
committed
refactor: use built-in type
1 parent 8457a19 commit afc9bf5

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

src/fake.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import * as core from 'zod/v4/core'
12
import { rootFake } from './internals/fake'
2-
import { ZodType } from './internals/type'
33

4-
export function fake<T extends ZodType>(schema: T): T['_zod']['output'] {
4+
export function fake<T extends core.$ZodType>(schema: T): T['_zod']['output'] {
55
return rootFake(schema, { depth: 0 })
66
}

src/internals/schemas/custom.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as core from 'zod/v4/core'
22
import { Context } from '../context'
3-
import { Fake, Infer, RootFake, ZodType } from '../type'
3+
import { Fake, Infer, RootFake } from '../type'
44

5-
const customs = new Map<ZodType, Fake<ZodType>>()
6-
export function custom<T extends ZodType>(schema: T, fake: Fake<T>): void {
5+
const customs = new Map<core.$ZodType, Fake<core.$ZodType>>()
6+
export function custom<T extends core.$ZodType>(schema: T, fake: Fake<T>): void {
77
customs.set(schema, fake as any)
88
}
99

src/internals/type.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1+
import * as core from 'zod/v4/core'
12
import { Context } from './context'
23

3-
export type ZodType<O = unknown> = { _zod: { output: O } } // TODO: use core.$ZodType
4+
export type Infer<T extends core.$ZodType> = T['_zod']['output']
45

5-
export type Infer<T extends ZodType> = T['_zod']['output']
6+
export type Fake<T extends core.$ZodType> = (schema: T, context: Context, fake: RootFake) => Infer<T>
67

7-
export type Fake<T extends ZodType> = (schema: T, context: Context, fake: RootFake) => Infer<T>
8-
9-
export type RootFake = <T extends ZodType>(schema: T, context: Context) => Infer<T>
8+
export type RootFake = <T extends core.$ZodType>(schema: T, context: Context) => Infer<T>

0 commit comments

Comments
 (0)