diff --git a/packages/validator/src/index.ts b/packages/validator/src/index.ts index c98f4f1..b59cc4b 100644 --- a/packages/validator/src/index.ts +++ b/packages/validator/src/index.ts @@ -56,7 +56,7 @@ function _useValidator( } } -declare module '@typp/core' { +declare module '@typp/core/base' { namespace t { export interface ErrorArgsMap { [k: string]: unknown[] diff --git a/packages/validator/src/types/literal.ts b/packages/validator/src/types/literal.ts index 113952e..e5e7ad2 100644 --- a/packages/validator/src/types/literal.ts +++ b/packages/validator/src/types/literal.ts @@ -1,7 +1,7 @@ import type { t as tn } from '@typp/core' -import { FALSY } from '../base' import type { SwitchBaseType } from '../base.inner' +import { FALSY } from '../base' import { preprocess } from '../utils.inner' import { bigintTransform } from './primitive.bigint' import { booleanTransform } from './primitive.boolean' @@ -9,7 +9,7 @@ import { numberTransform } from './primitive.number' import { stringTransform } from './primitive.string' import { symbolTransform } from './primitive.symbol' -declare module '@typp/core' { +declare module '@typp/core/base' { namespace t { export interface ValidateExtendsEntries { null: [ diff --git a/packages/validator/src/types/primitive.bigint.ts b/packages/validator/src/types/primitive.bigint.ts index e195ec1..c24e60f 100644 --- a/packages/validator/src/types/primitive.bigint.ts +++ b/packages/validator/src/types/primitive.bigint.ts @@ -1,11 +1,11 @@ -import type { IsEqual, IsSubType, IsTrue, IsWhat, Not, OnlySubType, t as tn } from '@typp/core' +import type { IsEqual, IsWhat, Not, OnlySubType, t as tn } from '@typp/core' -import { FALSY } from '../base' import type { LiteralTypeGuard, SwitchBaseType } from '../base.inner' +import { FALSY } from '../base' import { parseBigInt } from '../utils' import { preprocess } from '../utils.inner' -declare module '@typp/core' { +declare module '@typp/core/base' { namespace t { export interface ValidateExtendsEntries { bigint: [IsWhat, bigint | BigInt] @@ -64,7 +64,7 @@ export const bigintTransform: tn.Validator['transform'] = function (inpu } else if (input === -Infinity) { return 2n ** 1024n * -1n } else if (Number.isNaN(input)) { - throw new Error('NaN cannot be converted to BigInt') + throw new TypeError('NaN cannot be converted to BigInt') } else { if (input > Number.MAX_SAFE_INTEGER || input < Number.MIN_SAFE_INTEGER) { throw new Error('number must greater than or equal to -2^53 and less than or equal to 2^53') diff --git a/packages/validator/src/types/primitive.boolean.ts b/packages/validator/src/types/primitive.boolean.ts index 6ceff66..5aeed6c 100644 --- a/packages/validator/src/types/primitive.boolean.ts +++ b/packages/validator/src/types/primitive.boolean.ts @@ -4,7 +4,7 @@ import { FALSY } from '../base' import type { LiteralTypeGuard, SwitchBaseType } from '../base.inner' import { preprocess } from '../utils.inner' -declare module '@typp/core' { +declare module '@typp/core/base' { namespace t { export interface ValidateExtendsEntries { boolean: [ diff --git a/packages/validator/src/types/primitive.number.ts b/packages/validator/src/types/primitive.number.ts index 7e1e631..23ce9cf 100644 --- a/packages/validator/src/types/primitive.number.ts +++ b/packages/validator/src/types/primitive.number.ts @@ -4,7 +4,7 @@ import { FALSY } from '../base' import type { LiteralTypeGuard, SwitchBaseType } from '../base.inner' import { preprocess } from '../utils.inner' -declare module '@typp/core' { +declare module '@typp/core/base' { namespace t { export interface ValidateExtendsEntries { number: [ diff --git a/packages/validator/src/types/primitive.string.ts b/packages/validator/src/types/primitive.string.ts index 21e8be9..788f271 100644 --- a/packages/validator/src/types/primitive.string.ts +++ b/packages/validator/src/types/primitive.string.ts @@ -3,7 +3,7 @@ import type { IsWhat, OnlySubType, t as tn } from '@typp/core' import type { LiteralTypeGuard, SwitchBaseType } from '../base.inner' import { preprocess } from '../utils.inner' -declare module '@typp/core' { +declare module '@typp/core/base' { namespace t { export interface ValidateExtendsEntries { string: [ diff --git a/packages/validator/src/types/primitive.symbol.ts b/packages/validator/src/types/primitive.symbol.ts index 76d0139..c018bbe 100644 --- a/packages/validator/src/types/primitive.symbol.ts +++ b/packages/validator/src/types/primitive.symbol.ts @@ -3,7 +3,7 @@ import type { IsWhat, OnlySubType, t as tn } from '@typp/core' import type { LiteralTypeGuard } from '../base.inner' import { preprocess } from '../utils.inner' -declare module '@typp/core' { +declare module '@typp/core/base' { namespace t { export interface ValidateExtendsEntries { symbol: [ diff --git a/packages/validator/src/types/structural.ts b/packages/validator/src/types/structural.ts index 20add91..219d498 100644 --- a/packages/validator/src/types/structural.ts +++ b/packages/validator/src/types/structural.ts @@ -7,7 +7,7 @@ import { FALSY } from '../base' // TODO record // TODO class/instanceof -declare module '@typp/core' { +declare module '@typp/core/base' { namespace t { export interface ErrorArgsMap { /**