Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
colinhacks committed Mar 15, 2024
1 parent 4a618ef commit 18a0c28
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 64 deletions.
26 changes: 15 additions & 11 deletions deno/lib/__tests__/firstpartyschematypes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<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 };
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);
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
82 changes: 41 additions & 41 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 15 additions & 11 deletions src/__tests__/firstpartyschematypes.test.ts
Original file line number Diff line number Diff line change
@@ -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<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 };
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);
});

0 comments on commit 18a0c28

Please sign in to comment.