diff --git a/deno/lib/__tests__/firstpartyschematypes.test.ts b/deno/lib/__tests__/firstpartyschematypes.test.ts index d08818dbd..96e78d796 100644 --- a/deno/lib/__tests__/firstpartyschematypes.test.ts +++ b/deno/lib/__tests__/firstpartyschematypes.test.ts @@ -2,20 +2,24 @@ import { expect } from "https://deno.land/x/expect@v0.2.6/mod.ts"; const test = Deno.test; -import { - ZodFirstPartySchemaTypes, - ZodFirstPartyTypeKind, -} from "../index.ts"; +import { ZodFirstPartySchemaTypes, ZodFirstPartyTypeKind } from "../index.ts"; import { util } from "../helpers/util.ts"; test("Identify missing [ZodFirstPartySchemaTypes]", () => { - type ZodFirstPartySchemaForType = ZodFirstPartySchemaTypes extends infer Schema - ? Schema extends { _def: { typeName: T } } - ? Schema - : never - : never; - type ZodMappedTypes = { [key in ZodFirstPartyTypeKind]: ZodFirstPartySchemaForType }; - type ZodFirstPartySchemaTypesMissingFromUnion = keyof { [key in keyof ZodMappedTypes as ZodMappedTypes[key] extends { _def: never } ? key : never]: unknown }; + type ZodFirstPartySchemaForType = + ZodFirstPartySchemaTypes extends infer Schema + ? Schema extends { _def: { typeName: T } } + ? Schema + : never + : never; + type ZodMappedTypes = { + [key in ZodFirstPartyTypeKind]: ZodFirstPartySchemaForType; + }; + type ZodFirstPartySchemaTypesMissingFromUnion = keyof { + [key in keyof ZodMappedTypes as ZodMappedTypes[key] extends { _def: never } + ? key + : never]: unknown; + }; util.assertEqual(true); }); diff --git a/package.json b/package.json index ca5bef41e..4574a6f1d 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "ts-node": "^10.9.1", "tslib": "^2.3.1", "tsx": "^3.8.0", - "typescript": "~5.4.2", + "typescript": "~4.5.5", "vitest": "^0.32.2" }, "exports": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6f0d25a9e..1a096710a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,7 +16,7 @@ devDependencies: version: 7.23.3(@babel/core@7.24.0) '@rollup/plugin-typescript': specifier: ^8.2.0 - version: 8.5.0(rollup@2.79.1)(tslib@2.6.2)(typescript@5.4.2) + version: 8.5.0(rollup@2.79.1)(tslib@2.6.2)(typescript@4.5.5) '@swc/core': specifier: ^1.3.66 version: 1.4.6 @@ -34,10 +34,10 @@ devDependencies: version: 14.18.63 '@typescript-eslint/eslint-plugin': specifier: ^5.15.0 - version: 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.57.0)(typescript@5.4.2) + version: 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.57.0)(typescript@4.5.5) '@typescript-eslint/parser': specifier: ^5.15.0 - version: 5.62.0(eslint@8.57.0)(typescript@5.4.2) + version: 5.62.0(eslint@8.57.0)(typescript@4.5.5) babel-jest: specifier: ^29.5.0 version: 29.7.0(@babel/core@7.24.0) @@ -88,13 +88,13 @@ devDependencies: version: 2.79.1 ts-jest: specifier: ^29.1.0 - version: 29.1.2(@babel/core@7.24.0)(babel-jest@29.7.0)(jest@29.7.0)(typescript@5.4.2) + version: 29.1.2(@babel/core@7.24.0)(babel-jest@29.7.0)(jest@29.7.0)(typescript@4.5.5) ts-morph: specifier: ^14.0.0 version: 14.0.0 ts-node: specifier: ^10.9.1 - version: 10.9.2(@swc/core@1.4.6)(@types/node@14.18.63)(typescript@5.4.2) + version: 10.9.2(@swc/core@1.4.6)(@types/node@14.18.63)(typescript@4.5.5) tslib: specifier: ^2.3.1 version: 2.6.2 @@ -102,8 +102,8 @@ devDependencies: specifier: ^3.8.0 version: 3.14.0 typescript: - specifier: ~5.4.2 - version: 5.4.2 + specifier: ~4.5.5 + version: 4.5.5 vitest: specifier: ^0.32.2 version: 0.32.4 @@ -1920,7 +1920,7 @@ packages: fastq: 1.17.1 dev: true - /@rollup/plugin-typescript@8.5.0(rollup@2.79.1)(tslib@2.6.2)(typescript@5.4.2): + /@rollup/plugin-typescript@8.5.0(rollup@2.79.1)(tslib@2.6.2)(typescript@4.5.5): resolution: {integrity: sha512-wMv1/scv0m/rXx21wD2IsBbJFba8wGF3ErJIr6IKRfRj49S85Lszbxb4DCo8iILpluTjk2GAAu9CoZt4G3ppgQ==} engines: {node: '>=8.0.0'} peerDependencies: @@ -1935,7 +1935,7 @@ packages: resolve: 1.22.8 rollup: 2.79.1 tslib: 2.6.2 - typescript: 5.4.2 + typescript: 4.5.5 dev: true /@rollup/pluginutils@3.1.0(rollup@2.79.1): @@ -2232,7 +2232,7 @@ packages: '@types/yargs-parser': 21.0.3 dev: true - /@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.57.0)(typescript@5.4.2): + /@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.57.0)(typescript@4.5.5): resolution: {integrity: sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2244,23 +2244,23 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.10.0 - '@typescript-eslint/parser': 5.62.0(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/parser': 5.62.0(eslint@8.57.0)(typescript@4.5.5) '@typescript-eslint/scope-manager': 5.62.0 - '@typescript-eslint/type-utils': 5.62.0(eslint@8.57.0)(typescript@5.4.2) - '@typescript-eslint/utils': 5.62.0(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/type-utils': 5.62.0(eslint@8.57.0)(typescript@4.5.5) + '@typescript-eslint/utils': 5.62.0(eslint@8.57.0)(typescript@4.5.5) debug: 4.3.4(supports-color@9.4.0) eslint: 8.57.0 graphemer: 1.4.0 ignore: 5.3.1 natural-compare-lite: 1.4.0 semver: 7.6.0 - tsutils: 3.21.0(typescript@5.4.2) - typescript: 5.4.2 + tsutils: 3.21.0(typescript@4.5.5) + typescript: 4.5.5 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser@5.62.0(eslint@8.57.0)(typescript@5.4.2): + /@typescript-eslint/parser@5.62.0(eslint@8.57.0)(typescript@4.5.5): resolution: {integrity: sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2272,10 +2272,10 @@ packages: dependencies: '@typescript-eslint/scope-manager': 5.62.0 '@typescript-eslint/types': 5.62.0 - '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.4.2) + '@typescript-eslint/typescript-estree': 5.62.0(typescript@4.5.5) debug: 4.3.4(supports-color@9.4.0) eslint: 8.57.0 - typescript: 5.4.2 + typescript: 4.5.5 transitivePeerDependencies: - supports-color dev: true @@ -2288,7 +2288,7 @@ packages: '@typescript-eslint/visitor-keys': 5.62.0 dev: true - /@typescript-eslint/type-utils@5.62.0(eslint@8.57.0)(typescript@5.4.2): + /@typescript-eslint/type-utils@5.62.0(eslint@8.57.0)(typescript@4.5.5): resolution: {integrity: sha512-xsSQreu+VnfbqQpW5vnCJdq1Z3Q0U31qiWmRhr98ONQmcp/yhiPJFPq8MXiJVLiksmOKSjIldZzkebzHuCGzew==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2298,12 +2298,12 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.4.2) - '@typescript-eslint/utils': 5.62.0(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/typescript-estree': 5.62.0(typescript@4.5.5) + '@typescript-eslint/utils': 5.62.0(eslint@8.57.0)(typescript@4.5.5) debug: 4.3.4(supports-color@9.4.0) eslint: 8.57.0 - tsutils: 3.21.0(typescript@5.4.2) - typescript: 5.4.2 + tsutils: 3.21.0(typescript@4.5.5) + typescript: 4.5.5 transitivePeerDependencies: - supports-color dev: true @@ -2313,7 +2313,7 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/typescript-estree@5.62.0(typescript@5.4.2): + /@typescript-eslint/typescript-estree@5.62.0(typescript@4.5.5): resolution: {integrity: sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2328,13 +2328,13 @@ packages: globby: 11.1.0 is-glob: 4.0.3 semver: 7.6.0 - tsutils: 3.21.0(typescript@5.4.2) - typescript: 5.4.2 + tsutils: 3.21.0(typescript@4.5.5) + typescript: 4.5.5 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/utils@5.62.0(eslint@8.57.0)(typescript@5.4.2): + /@typescript-eslint/utils@5.62.0(eslint@8.57.0)(typescript@4.5.5): resolution: {integrity: sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2345,7 +2345,7 @@ packages: '@types/semver': 7.5.8 '@typescript-eslint/scope-manager': 5.62.0 '@typescript-eslint/types': 5.62.0 - '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.4.2) + '@typescript-eslint/typescript-estree': 5.62.0(typescript@4.5.5) eslint: 8.57.0 eslint-scope: 5.1.1 semver: 7.6.0 @@ -3422,7 +3422,7 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 5.62.0(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/parser': 5.62.0(eslint@8.57.0)(typescript@4.5.5) debug: 3.2.7(supports-color@5.5.0) eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 @@ -3447,7 +3447,7 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 5.62.0(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/parser': 5.62.0(eslint@8.57.0)(typescript@4.5.5) array-includes: 3.1.7 array.prototype.findlastindex: 1.2.4 array.prototype.flat: 1.3.2 @@ -3490,7 +3490,7 @@ packages: '@typescript-eslint/eslint-plugin': optional: true dependencies: - '@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.57.0)(typescript@4.5.5) eslint: 8.57.0 eslint-rule-composer: 0.3.0 dev: true @@ -4404,7 +4404,7 @@ packages: pretty-format: 29.7.0 slash: 3.0.0 strip-json-comments: 3.1.1 - ts-node: 10.9.2(@swc/core@1.4.6)(@types/node@14.18.63)(typescript@5.4.2) + ts-node: 10.9.2(@swc/core@1.4.6)(@types/node@14.18.63)(typescript@4.5.5) transitivePeerDependencies: - babel-plugin-macros - supports-color @@ -5978,7 +5978,7 @@ packages: nopt: 1.0.10 dev: true - /ts-jest@29.1.2(@babel/core@7.24.0)(babel-jest@29.7.0)(jest@29.7.0)(typescript@5.4.2): + /ts-jest@29.1.2(@babel/core@7.24.0)(babel-jest@29.7.0)(jest@29.7.0)(typescript@4.5.5): resolution: {integrity: sha512-br6GJoH/WUX4pu7FbZXuWGKGNDuU7b8Uj77g/Sp7puZV6EXzuByl6JrECvm0MzVzSTkSHWTihsXt+5XYER5b+g==} engines: {node: ^16.10.0 || ^18.0.0 || >=20.0.0} hasBin: true @@ -6009,7 +6009,7 @@ packages: lodash.memoize: 4.1.2 make-error: 1.3.6 semver: 7.6.0 - typescript: 5.4.2 + typescript: 4.5.5 yargs-parser: 21.1.1 dev: true @@ -6020,7 +6020,7 @@ packages: code-block-writer: 11.0.3 dev: true - /ts-node@10.9.2(@swc/core@1.4.6)(@types/node@14.18.63)(typescript@5.4.2): + /ts-node@10.9.2(@swc/core@1.4.6)(@types/node@14.18.63)(typescript@4.5.5): resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} hasBin: true peerDependencies: @@ -6047,7 +6047,7 @@ packages: create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 5.4.2 + typescript: 4.5.5 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 dev: true @@ -6077,14 +6077,14 @@ packages: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} dev: true - /tsutils@3.21.0(typescript@5.4.2): + /tsutils@3.21.0(typescript@4.5.5): resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} engines: {node: '>= 6'} peerDependencies: typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' dependencies: tslib: 1.14.1 - typescript: 5.4.2 + typescript: 4.5.5 dev: true /tsx@3.14.0: @@ -6164,9 +6164,9 @@ packages: possible-typed-array-names: 1.0.0 dev: true - /typescript@5.4.2: - resolution: {integrity: sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==} - engines: {node: '>=14.17'} + /typescript@4.5.5: + resolution: {integrity: sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==} + engines: {node: '>=4.2.0'} hasBin: true dev: true diff --git a/src/__tests__/firstpartyschematypes.test.ts b/src/__tests__/firstpartyschematypes.test.ts index 79b2b9592..56d3f53f6 100644 --- a/src/__tests__/firstpartyschematypes.test.ts +++ b/src/__tests__/firstpartyschematypes.test.ts @@ -1,20 +1,24 @@ // @ts-ignore TS6133 import { test } from "@jest/globals"; -import { - ZodFirstPartySchemaTypes, - ZodFirstPartyTypeKind, -} from ".."; +import { ZodFirstPartySchemaTypes, ZodFirstPartyTypeKind } from ".."; import { util } from "../helpers/util"; test("Identify missing [ZodFirstPartySchemaTypes]", () => { - type ZodFirstPartySchemaForType = ZodFirstPartySchemaTypes extends infer Schema - ? Schema extends { _def: { typeName: T } } - ? Schema - : never - : never; - type ZodMappedTypes = { [key in ZodFirstPartyTypeKind]: ZodFirstPartySchemaForType }; - type ZodFirstPartySchemaTypesMissingFromUnion = keyof { [key in keyof ZodMappedTypes as ZodMappedTypes[key] extends { _def: never } ? key : never]: unknown }; + type ZodFirstPartySchemaForType = + ZodFirstPartySchemaTypes extends infer Schema + ? Schema extends { _def: { typeName: T } } + ? Schema + : never + : never; + type ZodMappedTypes = { + [key in ZodFirstPartyTypeKind]: ZodFirstPartySchemaForType; + }; + type ZodFirstPartySchemaTypesMissingFromUnion = keyof { + [key in keyof ZodMappedTypes as ZodMappedTypes[key] extends { _def: never } + ? key + : never]: unknown; + }; util.assertEqual(true); });