Skip to content

Commit

Permalink
fix: type tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yamiteru committed Apr 29, 2024
1 parent 288d725 commit 83e3f38
Show file tree
Hide file tree
Showing 21 changed files with 20 additions and 50 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"build:stats": "bun run scripts/stats.ts",
"build:imports": "bun run scripts/imports.ts",
"build:website": "typedoc --basePath ./ --entryPoints src/index.ts --out website",
"test": "vitest run",
"test": "vitest run --typecheck",
"test:coverage": "vitest run --coverage",
"check": "bunx @biomejs/biome check --apply ./"
},
Expand Down
2 changes: 1 addition & 1 deletion src/assertions/array/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import { string } from "@assertions/string";
import type { Assertion } from "@the-minimal/types";
import { assertType } from "vitest";

assertType<Assertion<Array<string>>>(array(string));
assertType<Assertion<string[]>>(array(string));
3 changes: 1 addition & 2 deletions src/assertions/email/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { email } from "@assertions/email";
import type { Email } from "@assertions/email/types";
import type { Assertion } from "@the-minimal/types";
import { assertType } from "vitest";

assertType<Assertion<Email>>(email);
assertType<Assertion<unknown>>(email);
3 changes: 1 addition & 2 deletions src/assertions/endsWith/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { endsWith } from "@assertions/endsWith";
import type { EndsWith } from "@assertions/endsWith/types";
import type { Assertion } from "@the-minimal/types";
import { assertType } from "vitest";

assertType<Assertion<EndsWith<"?">>>(endsWith("?"));
assertType<Assertion<unknown>>(endsWith("?"));
3 changes: 1 addition & 2 deletions src/assertions/includes/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { includes } from "@assertions/includes";
import type { Includes } from "@assertions/includes/types";
import type { Assertion } from "@the-minimal/types";
import { assertType } from "vitest";

assertType<Assertion<Includes<"string">>>(includes("hello"));
assertType<Assertion<unknown>>(includes("hello"));
3 changes: 1 addition & 2 deletions src/assertions/integer/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { Integer } from "@assertions/integer/types";
import type { Assertion } from "@the-minimal/types";
import { assertType } from "vitest";
import { integer } from ".";

assertType<Assertion<Integer>>(integer);
assertType<Assertion<unknown>>(integer);
2 changes: 1 addition & 1 deletion src/assertions/isArray/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ import { isArray } from "@assertions/isArray/index";
import type { Assertion } from "@the-minimal/types";
import { assertType } from "vitest";

assertType<Assertion<Array<unknown>>>(isArray);
assertType<Assertion<unknown[]>>(isArray);
3 changes: 1 addition & 2 deletions src/assertions/isObject/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { isObject } from "@assertions/isObject/index";
import type { ObjectUnknown } from "@assertions/isObject/types";
import type { Assertion } from "@the-minimal/types";
import { assertType } from "vitest";

assertType<Assertion<ObjectUnknown>>(isObject);
assertType<Assertion<Record<string, unknown>>>(isObject);
3 changes: 1 addition & 2 deletions src/assertions/length/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { length } from "@assertions/length";
import type { Length } from "@assertions/length/types";
import type { Assertion } from "@the-minimal/types";
import { assertType } from "vitest";

assertType<Assertion<Length<2>>>(length(2));
assertType<Assertion<unknown>>(length(2));
3 changes: 1 addition & 2 deletions src/assertions/maxLength/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { maxLength } from "@assertions/maxLength";
import type { MaxLength } from "@assertions/maxLength/types";
import type { Assertion } from "@the-minimal/types";
import { assertType } from "vitest";

assertType<Assertion<MaxLength<2>>>(maxLength(2));
assertType<Assertion<unknown>>(maxLength(2));
3 changes: 1 addition & 2 deletions src/assertions/maxValue/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { maxValue } from "@assertions/maxValue";
import type { MaxValue } from "@assertions/maxValue/types";
import type { Assertion } from "@the-minimal/types";
import { assertType } from "vitest";

assertType<Assertion<MaxValue<17>>>(maxValue(17));
assertType<Assertion<unknown>>(maxValue(17));
3 changes: 1 addition & 2 deletions src/assertions/minLength/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { minLength } from "@assertions/minLength";
import type { MinLength } from "@assertions/minLength/types";
import type { Assertion } from "@the-minimal/types";
import { assertType } from "vitest";

assertType<Assertion<MinLength<2>>>(minLength(2));
assertType<Assertion<unknown>>(minLength(2));
3 changes: 1 addition & 2 deletions src/assertions/minValue/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { minValue } from "@assertions/minValue";
import type { MinValue } from "@assertions/minValue/types";
import type { Assertion } from "@the-minimal/types";
import { assertType } from "vitest";

assertType<Assertion<MinValue<18>>>(minValue(18));
assertType<Assertion<unknown>>(minValue(18));
3 changes: 1 addition & 2 deletions src/assertions/modulo/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { modulo } from "@assertions/modulo/index";
import type { Modulo } from "@assertions/modulo/types";
import type { Assertion } from "@the-minimal/types";
import { assertType } from "vitest";

assertType<Assertion<Modulo<2, 0>>>(modulo(2, 0));
assertType<Assertion<unknown>>(modulo(2, 0));
3 changes: 1 addition & 2 deletions src/assertions/notLength/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { notLength } from "@assertions/notLength";
import type { NotLength } from "@assertions/notLength/types";
import type { Assertion } from "@the-minimal/types";
import { assertType } from "vitest";

assertType<Assertion<NotLength<2>>>(notLength(2));
assertType<Assertion<unknown>>(notLength(2));
3 changes: 1 addition & 2 deletions src/assertions/notValue/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { notValue } from "@assertions/notValue";
import type { NotValue } from "@assertions/notValue/types";
import type { Assertion } from "@the-minimal/types";
import { assertType } from "vitest";

assertType<Assertion<NotValue<2>>>(notValue(2));
assertType<Assertion<unknown>>(notValue(2));
3 changes: 1 addition & 2 deletions src/assertions/rangeLength/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { RangeLength } from "@assertions/rangeLength/types";
import type { Assertion } from "@the-minimal/types";
import { assertType } from "vitest";
import { rangeLength } from ".";

assertType<Assertion<RangeLength<8, 16>>>(rangeLength(8, 16));
assertType<Assertion<unknown>>(rangeLength(8, 16));
3 changes: 1 addition & 2 deletions src/assertions/rangeValue/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { rangeValue } from "@assertions/rangeValue";
import type { RangeValue } from "@assertions/rangeValue/types";
import type { Assertion } from "@the-minimal/types";
import { assertType } from "vitest";

assertType<Assertion<RangeValue<0, 150>>>(rangeValue(0, 150));
assertType<Assertion<unknown>>(rangeValue(0, 150));
3 changes: 1 addition & 2 deletions src/assertions/regex/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { regex } from "@assertions/regex";
import type { Regex } from "@assertions/regex/types";
import type { Assertion } from "@the-minimal/types";
import { assertType } from "vitest";

assertType<Assertion<Regex<"digits">>>(regex<"digits">(/[0-9]/));
assertType<Assertion<unknown>>(regex(/[0-9]/));
3 changes: 1 addition & 2 deletions src/assertions/startsWith/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { startsWith } from "@assertions/startsWith";
import type { StartsWith } from "@assertions/startsWith/types";
import type { Assertion } from "@the-minimal/types";
import { assertType } from "vitest";

assertType<Assertion<StartsWith<"ID: ">>>(startsWith("ID: "));
assertType<Assertion<unknown>>(startsWith("ID: "));
13 changes: 0 additions & 13 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,2 @@
import { and } from "@assertions/and";
import { email } from "@assertions/email";
import { object } from "@assertions/object";
import { string } from "@assertions/string";

export * from "./types";
export * from "./assertions";

const user = object({
email: and([string, email]),
});

// const zodUser = object({
// email: string().email()
// });

0 comments on commit 83e3f38

Please sign in to comment.