-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test
ZodFirstPartySchemaTypes
in sync with ZodFirstPartyTypeKind
- Loading branch information
1 parent
2762d1f
commit d22f342
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// @ts-ignore TS6133 | ||
import { test } from "@jest/globals"; | ||
import { util } from "../helpers/util"; | ||
|
||
import { | ||
ZodFirstPartySchemaTypes, | ||
ZodFirstPartyTypeKind, | ||
} from ".."; | ||
|
||
test("Identify missing [ZodFirstPartySchemaTypes]", () => { | ||
type ZodFirstPartySchemaForType<T extends ZodFirstPartyTypeKind> = ZodFirstPartySchemaTypes extends infer Schema | ||
? Schema extends { _def: { typeName: T } } | ||
? Schema | ||
: never | ||
: never; | ||
type ZodMappedTypes = { [key in ZodFirstPartyTypeKind]: ZodFirstPartySchemaForType<key> }; | ||
type ZodFirstPartySchemaTypesMissingFromUnion = keyof { [key in keyof ZodMappedTypes as ZodMappedTypes[key] extends { _def: never } ? key : never]: unknown }; | ||
|
||
util.assertNever({} as ZodFirstPartySchemaTypesMissingFromUnion); | ||
}); |