From 83e3f38195f0dededea70fc01335d30202b0f38a Mon Sep 17 00:00:00 2001 From: Yamiteru Date: Mon, 29 Apr 2024 21:49:37 +0200 Subject: [PATCH] fix: type tests --- package.json | 2 +- src/assertions/array/index.test-d.ts | 2 +- src/assertions/email/index.test-d.ts | 3 +-- src/assertions/endsWith/index.test-d.ts | 3 +-- src/assertions/includes/index.test-d.ts | 3 +-- src/assertions/integer/index.test-d.ts | 3 +-- src/assertions/isArray/index.test-d.ts | 2 +- src/assertions/isObject/index.test-d.ts | 3 +-- src/assertions/length/index.test-d.ts | 3 +-- src/assertions/maxLength/index.test-d.ts | 3 +-- src/assertions/maxValue/index.test-d.ts | 3 +-- src/assertions/minLength/index.test-d.ts | 3 +-- src/assertions/minValue/index.test-d.ts | 3 +-- src/assertions/modulo/index.test-d.ts | 3 +-- src/assertions/notLength/index.test-d.ts | 3 +-- src/assertions/notValue/index.test-d.ts | 3 +-- src/assertions/rangeLength/index.test-d.ts | 3 +-- src/assertions/rangeValue/index.test-d.ts | 3 +-- src/assertions/regex/index.test-d.ts | 3 +-- src/assertions/startsWith/index.test-d.ts | 3 +-- src/index.ts | 13 ------------- 21 files changed, 20 insertions(+), 50 deletions(-) diff --git a/package.json b/package.json index 1870f8d..29c0017 100644 --- a/package.json +++ b/package.json @@ -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 ./" }, diff --git a/src/assertions/array/index.test-d.ts b/src/assertions/array/index.test-d.ts index 36642e4..d034d4a 100644 --- a/src/assertions/array/index.test-d.ts +++ b/src/assertions/array/index.test-d.ts @@ -3,4 +3,4 @@ import { string } from "@assertions/string"; import type { Assertion } from "@the-minimal/types"; import { assertType } from "vitest"; -assertType>>(array(string)); +assertType>(array(string)); diff --git a/src/assertions/email/index.test-d.ts b/src/assertions/email/index.test-d.ts index 92f4d9b..3e13f44 100644 --- a/src/assertions/email/index.test-d.ts +++ b/src/assertions/email/index.test-d.ts @@ -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>(email); +assertType>(email); diff --git a/src/assertions/endsWith/index.test-d.ts b/src/assertions/endsWith/index.test-d.ts index 47001b3..04191d7 100644 --- a/src/assertions/endsWith/index.test-d.ts +++ b/src/assertions/endsWith/index.test-d.ts @@ -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>>(endsWith("?")); +assertType>(endsWith("?")); diff --git a/src/assertions/includes/index.test-d.ts b/src/assertions/includes/index.test-d.ts index 663444e..43b3ee6 100644 --- a/src/assertions/includes/index.test-d.ts +++ b/src/assertions/includes/index.test-d.ts @@ -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>>(includes("hello")); +assertType>(includes("hello")); diff --git a/src/assertions/integer/index.test-d.ts b/src/assertions/integer/index.test-d.ts index b9aa5e0..44ab913 100644 --- a/src/assertions/integer/index.test-d.ts +++ b/src/assertions/integer/index.test-d.ts @@ -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>(integer); +assertType>(integer); diff --git a/src/assertions/isArray/index.test-d.ts b/src/assertions/isArray/index.test-d.ts index 03cf6e7..7c61502 100644 --- a/src/assertions/isArray/index.test-d.ts +++ b/src/assertions/isArray/index.test-d.ts @@ -2,4 +2,4 @@ import { isArray } from "@assertions/isArray/index"; import type { Assertion } from "@the-minimal/types"; import { assertType } from "vitest"; -assertType>>(isArray); +assertType>(isArray); diff --git a/src/assertions/isObject/index.test-d.ts b/src/assertions/isObject/index.test-d.ts index 91a585c..aeccf30 100644 --- a/src/assertions/isObject/index.test-d.ts +++ b/src/assertions/isObject/index.test-d.ts @@ -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>(isObject); +assertType>>(isObject); diff --git a/src/assertions/length/index.test-d.ts b/src/assertions/length/index.test-d.ts index 0469b37..a9f2623 100644 --- a/src/assertions/length/index.test-d.ts +++ b/src/assertions/length/index.test-d.ts @@ -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>>(length(2)); +assertType>(length(2)); diff --git a/src/assertions/maxLength/index.test-d.ts b/src/assertions/maxLength/index.test-d.ts index b2ca553..ea5fa48 100644 --- a/src/assertions/maxLength/index.test-d.ts +++ b/src/assertions/maxLength/index.test-d.ts @@ -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>>(maxLength(2)); +assertType>(maxLength(2)); diff --git a/src/assertions/maxValue/index.test-d.ts b/src/assertions/maxValue/index.test-d.ts index a180530..edcd8b4 100644 --- a/src/assertions/maxValue/index.test-d.ts +++ b/src/assertions/maxValue/index.test-d.ts @@ -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>>(maxValue(17)); +assertType>(maxValue(17)); diff --git a/src/assertions/minLength/index.test-d.ts b/src/assertions/minLength/index.test-d.ts index 36d555f..4a1add6 100644 --- a/src/assertions/minLength/index.test-d.ts +++ b/src/assertions/minLength/index.test-d.ts @@ -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>>(minLength(2)); +assertType>(minLength(2)); diff --git a/src/assertions/minValue/index.test-d.ts b/src/assertions/minValue/index.test-d.ts index 93d62f8..5aa099d 100644 --- a/src/assertions/minValue/index.test-d.ts +++ b/src/assertions/minValue/index.test-d.ts @@ -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>>(minValue(18)); +assertType>(minValue(18)); diff --git a/src/assertions/modulo/index.test-d.ts b/src/assertions/modulo/index.test-d.ts index 94f53d3..f2997d8 100644 --- a/src/assertions/modulo/index.test-d.ts +++ b/src/assertions/modulo/index.test-d.ts @@ -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>>(modulo(2, 0)); +assertType>(modulo(2, 0)); diff --git a/src/assertions/notLength/index.test-d.ts b/src/assertions/notLength/index.test-d.ts index 286a1a1..91ce9b7 100644 --- a/src/assertions/notLength/index.test-d.ts +++ b/src/assertions/notLength/index.test-d.ts @@ -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>>(notLength(2)); +assertType>(notLength(2)); diff --git a/src/assertions/notValue/index.test-d.ts b/src/assertions/notValue/index.test-d.ts index f8ab6aa..ecc50a0 100644 --- a/src/assertions/notValue/index.test-d.ts +++ b/src/assertions/notValue/index.test-d.ts @@ -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>>(notValue(2)); +assertType>(notValue(2)); diff --git a/src/assertions/rangeLength/index.test-d.ts b/src/assertions/rangeLength/index.test-d.ts index 0e45872..1d96da0 100644 --- a/src/assertions/rangeLength/index.test-d.ts +++ b/src/assertions/rangeLength/index.test-d.ts @@ -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>>(rangeLength(8, 16)); +assertType>(rangeLength(8, 16)); diff --git a/src/assertions/rangeValue/index.test-d.ts b/src/assertions/rangeValue/index.test-d.ts index 4666501..062f11b 100644 --- a/src/assertions/rangeValue/index.test-d.ts +++ b/src/assertions/rangeValue/index.test-d.ts @@ -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>>(rangeValue(0, 150)); +assertType>(rangeValue(0, 150)); diff --git a/src/assertions/regex/index.test-d.ts b/src/assertions/regex/index.test-d.ts index e1f0533..c3b89f6 100644 --- a/src/assertions/regex/index.test-d.ts +++ b/src/assertions/regex/index.test-d.ts @@ -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>>(regex<"digits">(/[0-9]/)); +assertType>(regex(/[0-9]/)); diff --git a/src/assertions/startsWith/index.test-d.ts b/src/assertions/startsWith/index.test-d.ts index c1634c4..57da158 100644 --- a/src/assertions/startsWith/index.test-d.ts +++ b/src/assertions/startsWith/index.test-d.ts @@ -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>>(startsWith("ID: ")); +assertType>(startsWith("ID: ")); diff --git a/src/index.ts b/src/index.ts index 6f8d4eb..c3bd2e4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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() -// });