@augment-vir/common
Advanced tools
@@ -6,8 +6,8 @@ import { AnyFunction } from './function'; | ||
| export type RuntimeTypeOfMapping = { | ||
| array: any[]; | ||
| array: any[] | ReadonlyArray<any>; | ||
| bigint: bigint; | ||
| boolean: boolean; | ||
| function: AnyFunction; | ||
| function: AnyFunction | Readonly<AnyFunction>; | ||
| number: number; | ||
| object: Record<PropertyKey, unknown>; | ||
| object: Record<PropertyKey, unknown> | Readonly<Record<PropertyKey, unknown>>; | ||
| string: string; | ||
@@ -19,4 +19,4 @@ symbol: symbol; | ||
| export declare function isRuntimeTypeOf<T extends RuntimeTypeOf>(input: unknown, testType: T): input is RuntimeTypeOfMapping[T]; | ||
| export declare function assertRuntimeTypeOf<T extends RuntimeTypeOf>(input: unknown, testType: T): asserts input is RuntimeTypeOfMapping[T]; | ||
| export declare function assertRuntimeTypeOf<T extends RuntimeTypeOf>(input: unknown, testType: T, inputName: string): asserts input is RuntimeTypeOfMapping[T]; | ||
| export {}; | ||
| //# sourceMappingURL=runtime-type-of.d.ts.map |
@@ -18,7 +18,7 @@ "use strict"; | ||
| exports.isRuntimeTypeOf = isRuntimeTypeOf; | ||
| function assertRuntimeTypeOf(input, testType) { | ||
| function assertRuntimeTypeOf(input, testType, inputName) { | ||
| if (!isRuntimeTypeOf(input, testType)) { | ||
| throw new TypeError(`'${input}' is not of type '${testType}'`); | ||
| throw new TypeError(`'${inputName}' is of type '${getRuntimeTypeOf(input)}' but type '${testType}' was expected.`); | ||
| } | ||
| } | ||
| exports.assertRuntimeTypeOf = assertRuntimeTypeOf; |
@@ -61,2 +61,3 @@ import { Except, Simplify } from 'type-fest'; | ||
| export declare function ensureType<ExpectedType = never>(input: NoInfer<ExpectedType>): NoInfer<ExpectedType>; | ||
| export type TypedFunction<ParametersGeneric extends any[], ReturnTypeGeneric> = (...args: ParametersGeneric) => ReturnTypeGeneric; | ||
| //# sourceMappingURL=type.d.ts.map |
@@ -6,8 +6,8 @@ import { AnyFunction } from './function'; | ||
| export type RuntimeTypeOfMapping = { | ||
| array: any[]; | ||
| array: any[] | ReadonlyArray<any>; | ||
| bigint: bigint; | ||
| boolean: boolean; | ||
| function: AnyFunction; | ||
| function: AnyFunction | Readonly<AnyFunction>; | ||
| number: number; | ||
| object: Record<PropertyKey, unknown>; | ||
| object: Record<PropertyKey, unknown> | Readonly<Record<PropertyKey, unknown>>; | ||
| string: string; | ||
@@ -19,4 +19,4 @@ symbol: symbol; | ||
| export declare function isRuntimeTypeOf<T extends RuntimeTypeOf>(input: unknown, testType: T): input is RuntimeTypeOfMapping[T]; | ||
| export declare function assertRuntimeTypeOf<T extends RuntimeTypeOf>(input: unknown, testType: T): asserts input is RuntimeTypeOfMapping[T]; | ||
| export declare function assertRuntimeTypeOf<T extends RuntimeTypeOf>(input: unknown, testType: T, inputName: string): asserts input is RuntimeTypeOfMapping[T]; | ||
| export {}; | ||
| //# sourceMappingURL=runtime-type-of.d.ts.map |
@@ -13,6 +13,6 @@ // this function is not used at run time, it's only here for types | ||
| } | ||
| export function assertRuntimeTypeOf(input, testType) { | ||
| export function assertRuntimeTypeOf(input, testType, inputName) { | ||
| if (!isRuntimeTypeOf(input, testType)) { | ||
| throw new TypeError(`'${input}' is not of type '${testType}'`); | ||
| throw new TypeError(`'${inputName}' is of type '${getRuntimeTypeOf(input)}' but type '${testType}' was expected.`); | ||
| } | ||
| } |
@@ -61,2 +61,3 @@ import { Except, Simplify } from 'type-fest'; | ||
| export declare function ensureType<ExpectedType = never>(input: NoInfer<ExpectedType>): NoInfer<ExpectedType>; | ||
| export type TypedFunction<ParametersGeneric extends any[], ReturnTypeGeneric> = (...args: ParametersGeneric) => ReturnTypeGeneric; | ||
| //# sourceMappingURL=type.d.ts.map |
@@ -6,8 +6,8 @@ import { AnyFunction } from './function'; | ||
| export type RuntimeTypeOfMapping = { | ||
| array: any[]; | ||
| array: any[] | ReadonlyArray<any>; | ||
| bigint: bigint; | ||
| boolean: boolean; | ||
| function: AnyFunction; | ||
| function: AnyFunction | Readonly<AnyFunction>; | ||
| number: number; | ||
| object: Record<PropertyKey, unknown>; | ||
| object: Record<PropertyKey, unknown> | Readonly<Record<PropertyKey, unknown>>; | ||
| string: string; | ||
@@ -19,4 +19,4 @@ symbol: symbol; | ||
| export declare function isRuntimeTypeOf<T extends RuntimeTypeOf>(input: unknown, testType: T): input is RuntimeTypeOfMapping[T]; | ||
| export declare function assertRuntimeTypeOf<T extends RuntimeTypeOf>(input: unknown, testType: T): asserts input is RuntimeTypeOfMapping[T]; | ||
| export declare function assertRuntimeTypeOf<T extends RuntimeTypeOf>(input: unknown, testType: T, inputName: string): asserts input is RuntimeTypeOfMapping[T]; | ||
| export {}; | ||
| //# sourceMappingURL=runtime-type-of.d.ts.map |
@@ -61,2 +61,3 @@ import { Except, Simplify } from 'type-fest'; | ||
| export declare function ensureType<ExpectedType = never>(input: NoInfer<ExpectedType>): NoInfer<ExpectedType>; | ||
| export type TypedFunction<ParametersGeneric extends any[], ReturnTypeGeneric> = (...args: ParametersGeneric) => ReturnTypeGeneric; | ||
| //# sourceMappingURL=type.d.ts.map |
+2
-2
| { | ||
| "name": "@augment-vir/common", | ||
| "version": "11.3.1", | ||
| "version": "12.0.0", | ||
| "homepage": "https://github.com/electrovir/augment-vir/tree/main/packages/common", | ||
@@ -27,3 +27,3 @@ "bugs": { | ||
| "dependencies": { | ||
| "type-fest": "^3.5.1" | ||
| "type-fest": "^3.5.3" | ||
| }, | ||
@@ -30,0 +30,0 @@ "devDependencies": { |
173118
0.48%3465
0.09%Updated