diff --git a/app/generators/uuid/page.tsx b/app/generators/uuid/page.tsx index cec2c1a..5251745 100644 --- a/app/generators/uuid/page.tsx +++ b/app/generators/uuid/page.tsx @@ -2,7 +2,6 @@ import { useCallback, useState } from "react"; import { range } from "fp-ts/NonEmptyArray"; -import * as t from "io-ts"; import { toolGroups } from "@/config/tools"; import { uuid } from "@/lib/uuid"; @@ -26,8 +25,11 @@ const versions = { v4: "4", } as const; -const uuidVersions = t.keyof({ [versions.v1]: null, [versions.v4]: null }); -type UuidVersion = t.TypeOf; +type UuidVersion = (typeof versions)[keyof typeof versions]; + +function isUuidVersion(s: string): s is UuidVersion { + return Object.values(versions).includes(s as UuidVersion); +} export default function Page() { const [hyphens, setHyphens] = useState(true); @@ -42,7 +44,7 @@ export default function Page() { const clearUuids = useCallback(() => setUuids([]), []); const onUuidVersionChange: NonNullable = useCallback(value => { - if (uuidVersions.is(value)) { + if (isUuidVersion(value)) { setUuidVersion(value); } }, []); diff --git a/package.json b/package.json index b9ca3a8..8bce879 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ "fp-ts": "^2.16.0", "fuse.js": "^6.6.2", "html-escaper": "^3.0.3", - "io-ts": "^2.2.20", "js-base64": "^3.7.5", "js-yaml": "^4.1.0", "jwt-decode": "^3.1.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 11fbc80..0c284e3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -43,9 +43,6 @@ dependencies: html-escaper: specifier: ^3.0.3 version: 3.0.3 - io-ts: - specifier: ^2.2.20 - version: 2.2.20(fp-ts@2.16.0) js-base64: specifier: ^3.7.5 version: 3.7.5 @@ -3427,14 +3424,6 @@ packages: loose-envify: 1.4.0 dev: false - /io-ts@2.2.20(fp-ts@2.16.0): - resolution: {integrity: sha512-Rq2BsYmtwS5vVttie4rqrOCIfHCS9TgpRLFpKQCM1wZBBRY9nWVGmEvm2FnDbSE2un1UE39DvFpTR5UL47YDcA==} - peerDependencies: - fp-ts: ^2.5.0 - dependencies: - fp-ts: 2.16.0 - dev: false - /is-arguments@1.1.1: resolution: {integrity: sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==} engines: {node: '>= 0.4'}