Comparing version
@@ -14,2 +14,3 @@ import type { Medium, MediumName } from './medium'; | ||
export declare function fn<TArgumentTypeTuple extends [] | [TypeInMediumsPartial, ...TypeInMediumsPartial[]], TReturnType extends TypeInMediumsPartial>(ArgumentTypeTuple: TArgumentTypeTuple, ReturnType: TReturnType): FunctionType<TArgumentTypeTuple, TReturnType>; | ||
export { fn as function }; | ||
type FunctionInMediums<TArgumentTypeTuple extends TypeInMediumsPartial[], TReturnType extends TypeInMediumsPartial> = { | ||
@@ -21,2 +22,1 @@ [TMediumName in XValue.UsingName]: FunctionInMedium<TArgumentTypeTuple, TReturnType, TMediumName>; | ||
}) => TReturnType[__type_in_mediums][TMediumName]; | ||
export {}; |
"use strict"; | ||
var _a; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.fn = exports.FunctionType = void 0; | ||
exports.function = exports.fn = exports.FunctionType = void 0; | ||
const type_1 = require("./type"); | ||
@@ -152,2 +152,3 @@ const type_partials_1 = require("./type-partials"); | ||
exports.fn = fn; | ||
exports.function = fn; | ||
//# sourceMappingURL=function-type.js.map |
@@ -30,2 +30,3 @@ declare global { | ||
export declare const voidType: import("./core").AtomicType<typeof voidTypeSymbol>; | ||
export { voidType as void }; | ||
export declare const nullTypeSymbol: unique symbol; | ||
@@ -32,0 +33,0 @@ export declare const nullType: import("./core").AtomicType<typeof nullTypeSymbol>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.RegExp = exports.regexpTypeSymbol = exports.Date = exports.dateTypeSymbol = exports.boolean = exports.booleanTypeSymbol = exports.bigint = exports.bigintTypeSymbol = exports.number = exports.numberTypeSymbol = exports.string = exports.stringTypeSymbol = exports.nullType = exports.nullTypeSymbol = exports.voidType = exports.voidTypeSymbol = exports.undefined = exports.undefinedTypeSymbol = exports.unknown = exports.unknownTypeSymbol = exports.never = exports.neverTypeSymbol = void 0; | ||
exports.RegExp = exports.regexpTypeSymbol = exports.Date = exports.dateTypeSymbol = exports.boolean = exports.booleanTypeSymbol = exports.bigint = exports.bigintTypeSymbol = exports.number = exports.numberTypeSymbol = exports.string = exports.stringTypeSymbol = exports.nullType = exports.nullTypeSymbol = exports.void = exports.voidType = exports.voidTypeSymbol = exports.undefined = exports.undefinedTypeSymbol = exports.unknown = exports.unknownTypeSymbol = exports.never = exports.neverTypeSymbol = void 0; | ||
const core_1 = require("./core"); | ||
@@ -17,2 +17,3 @@ const utils_1 = require("./utils"); | ||
exports.voidType = (0, core_1.atomic)(exports.voidTypeSymbol, value => (0, utils_1.constraint)(value === void 0, () => `Expected undefined, getting ${toString.call(value)}.`)); | ||
exports.void = exports.voidType; | ||
exports.nullTypeSymbol = Symbol(); | ||
@@ -19,0 +20,0 @@ exports.nullType = (0, core_1.atomic)(exports.nullTypeSymbol, value => (0, utils_1.constraint)(value === null, () => `Expected null, getting ${toString.call(value)}.`)); |
import type { TypeInMediumsPartial, __type_in_mediums } from './core'; | ||
export type MediumTypeOf<TType extends TypeInMediumsPartial, TMediumName extends XValue.UsingName> = TType[__type_in_mediums][TMediumName]; | ||
export type MediumTypeOf<TMediumName extends XValue.UsingName, TType extends TypeInMediumsPartial> = TType[__type_in_mediums][TMediumName]; | ||
export declare function constraint(condition: boolean, message?: string | (() => string)): void; | ||
export declare function refinement<T>(condition: boolean, refined: T, message?: string | (() => string)): T; |
{ | ||
"name": "x-value", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"repository": "https://github.com/vilic/x-value.git", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -70,3 +70,3 @@ [](https://www.npmjs.com/package/x-value) | ||
type Oops = x.TypeOf<typeof Oops>; | ||
type JSONOops = x.MediumTypeOf<typeof Oops, 'json'>; | ||
type JSONOops = x.MediumTypeOf<'json', typeof Oops>; | ||
``` | ||
@@ -73,0 +73,0 @@ |
@@ -236,2 +236,4 @@ import type {Exact} from './@exact-context'; | ||
export {fn as function}; | ||
type FunctionInMediums< | ||
@@ -238,0 +240,0 @@ TArgumentTypeTuple extends TypeInMediumsPartial[], |
@@ -54,2 +54,4 @@ import {atomic} from './core'; | ||
export {voidType as void}; | ||
export const nullTypeSymbol = Symbol(); | ||
@@ -56,0 +58,0 @@ export const nullType = atomic(nullTypeSymbol, value => |
import type {TypeInMediumsPartial, __type_in_mediums} from './core'; | ||
export type MediumTypeOf< | ||
TMediumName extends XValue.UsingName, | ||
TType extends TypeInMediumsPartial, | ||
TMediumName extends XValue.UsingName, | ||
> = TType[__type_in_mediums][TMediumName]; | ||
@@ -7,0 +7,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
265371
0.08%5682
0.09%