-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f3811f
commit 0575b65
Showing
5 changed files
with
35 additions
and
4 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
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,21 @@ | ||
// @ts-ignore TS6133 | ||
import { expect } from "https://deno.land/x/expect@v0.2.6/mod.ts"; | ||
const test = Deno.test; | ||
|
||
import { | ||
ZodFirstPartySchemaTypes, | ||
ZodFirstPartyTypeKind, | ||
} from "../index.ts"; | ||
import { util } from "../helpers/util.ts"; | ||
|
||
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.assertEqual<ZodFirstPartySchemaTypesMissingFromUnion, never>(true); | ||
}); |
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
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
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