inferred-types 0.16.1 → 0.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.tsbuildinfo +1 -0
- package/dist/{types/utility/state/KeyStorage.d.ts → index.d.ts} +9780 -8195
- package/dist/index.js +687 -0
- package/dist/index.mjs +603 -0
- package/on-hold/Builder/index.ts +15 -21
- package/on-hold/types/index.ts +15 -20
- package/package.json +25 -36
- package/pnpm-lock.yaml +1680 -3233
- package/src/Mutation/index.ts +16 -18
- package/src/index.ts +15 -19
- package/src/shared/index.ts +16 -18
- package/src/types/Not.ts +3 -1
- package/src/types/Transformer.ts +1 -2
- package/src/types/Where.ts +36 -0
- package/src/types/alphabetic/PascalCase.ts +5 -4
- package/src/types/alphabetic/index.ts +16 -20
- package/src/types/dictionary/index.ts +16 -18
- package/src/types/{fluent.ts → fluent/fluent.ts} +8 -9
- package/src/types/fluent/index.ts +35 -0
- package/src/types/index.ts +18 -22
- package/src/types/kv/index.ts +16 -18
- package/src/types/lists/index.ts +16 -18
- package/src/types/ruleset-types.ts +1 -1
- package/src/types/string-literals/index.ts +16 -18
- package/src/types/tuples/index.ts +16 -18
- package/src/types/{SameKeys.ts → type-conversion/SameKeys.ts} +0 -0
- package/src/types/type-conversion/WrapValue.ts +15 -0
- package/src/types/type-conversion/index.ts +18 -18
- package/src/utility/api/index.ts +16 -18
- package/src/utility/dictionary/index.ts +16 -20
- package/src/utility/dictionary/kv/index.ts +16 -18
- package/src/utility/index.ts +16 -20
- package/src/utility/lists/index.ts +16 -18
- package/src/utility/literals/index.ts +16 -18
- package/src/utility/map-reduce/index.ts +16 -18
- package/src/utility/modelling/index.ts +16 -18
- package/src/utility/runtime/conditions/index.ts +16 -18
- package/src/utility/runtime/ifTypeOf.ts +1 -5
- package/src/utility/runtime/index.ts +16 -20
- package/src/utility/state/index.ts +16 -18
- package/tests/Where.spec.ts +39 -0
- package/tests/data/index.ts +9 -14
- package/tests/kv/dict-to-kv-and-back.spec.ts +6 -2
- package/tsconfig.json +4 -3
- package/dist/cjs/index.js +0 -1
- package/dist/es/index.js +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/types/Mutation/MutationFunction.d.ts +0 -16
- package/dist/types/Mutation/MutationIdentity.d.ts +0 -30
- package/dist/types/Mutation/index.d.ts +0 -2
- package/dist/types/errors/InferenceError.d.ts +0 -1
- package/dist/types/errors/index.d.ts +0 -1
- package/dist/types/index.d.ts +0 -4
- package/dist/types/shared/index.d.ts +0 -3
- package/dist/types/shared/randomString.d.ts +0 -1
- package/dist/types/shared/uuid.d.ts +0 -1
- package/dist/types/shared/valueTypes.d.ts +0 -27
- package/dist/types/types/Api.d.ts +0 -10
- package/dist/types/types/Constructor.d.ts +0 -5
- package/dist/types/types/EnumValues.d.ts +0 -14
- package/dist/types/types/ExpandRecursively.d.ts +0 -3
- package/dist/types/types/First.d.ts +0 -4
- package/dist/types/types/FunctionType.d.ts +0 -9
- package/dist/types/types/If.d.ts +0 -10
- package/dist/types/types/Include.d.ts +0 -16
- package/dist/types/types/Includes.d.ts +0 -5
- package/dist/types/types/KeyedRecord.d.ts +0 -22
- package/dist/types/types/Keys.d.ts +0 -17
- package/dist/types/types/Length.d.ts +0 -8
- package/dist/types/types/Mutable.d.ts +0 -6
- package/dist/types/types/Narrowable.d.ts +0 -5
- package/dist/types/types/Not.d.ts +0 -11
- package/dist/types/types/Numeric.d.ts +0 -14
- package/dist/types/types/Opaque.d.ts +0 -12
- package/dist/types/types/Retain.d.ts +0 -16
- package/dist/types/types/SameKeys.d.ts +0 -11
- package/dist/types/types/Transformer.d.ts +0 -11
- package/dist/types/types/TypeGuard.d.ts +0 -7
- package/dist/types/types/alphabetic/AllCaps.d.ts +0 -12
- package/dist/types/types/alphabetic/CamelCase.d.ts +0 -2
- package/dist/types/types/alphabetic/CapFirstAlpha.d.ts +0 -13
- package/dist/types/types/alphabetic/CapitalizeWords.d.ts +0 -4
- package/dist/types/types/alphabetic/DashToSnake.d.ts +0 -1
- package/dist/types/types/alphabetic/DashUppercase.d.ts +0 -14
- package/dist/types/types/alphabetic/Dasherize.d.ts +0 -15
- package/dist/types/types/alphabetic/HasUppercase.d.ts +0 -13
- package/dist/types/types/alphabetic/Intrinsic.d.ts +0 -4
- package/dist/types/types/alphabetic/IsCapitalized.d.ts +0 -15
- package/dist/types/types/alphabetic/KebabCase.d.ts +0 -12
- package/dist/types/types/alphabetic/LowerAllCaps.d.ts +0 -4
- package/dist/types/types/alphabetic/PascalCase.d.ts +0 -16
- package/dist/types/types/alphabetic/Pluralize.d.ts +0 -36
- package/dist/types/types/alphabetic/SnakeCase.d.ts +0 -14
- package/dist/types/types/alphabetic/alpha-characters.d.ts +0 -36
- package/dist/types/types/alphabetic/index.d.ts +0 -16
- package/dist/types/types/append-types.d.ts +0 -9
- package/dist/types/types/dictionary/Get.d.ts +0 -7
- package/dist/types/types/dictionary/index.d.ts +0 -1
- package/dist/types/types/fluent.d.ts +0 -51
- package/dist/types/types/index.d.ts +0 -35
- package/dist/types/types/kv/DictFromKv.d.ts +0 -6
- package/dist/types/types/kv/KeyValue.d.ts +0 -11
- package/dist/types/types/kv/KvFrom.d.ts +0 -13
- package/dist/types/types/kv/KvTuple.d.ts +0 -14
- package/dist/types/types/kv/index.d.ts +0 -4
- package/dist/types/types/lists/UniqueForProp.d.ts +0 -14
- package/dist/types/types/lists/index.d.ts +0 -1
- package/dist/types/types/maybe.d.ts +0 -8
- package/dist/types/types/props.d.ts +0 -100
- package/dist/types/types/ruleset-types.d.ts +0 -59
- package/dist/types/types/runtime.d.ts +0 -33
- package/dist/types/types/string-literals/Break.d.ts +0 -12
- package/dist/types/types/string-literals/Concat.d.ts +0 -8
- package/dist/types/types/string-literals/LeftWhitespace.d.ts +0 -9
- package/dist/types/types/string-literals/Replace.d.ts +0 -11
- package/dist/types/types/string-literals/RightWhitespace.d.ts +0 -9
- package/dist/types/types/string-literals/StringLength.d.ts +0 -10
- package/dist/types/types/string-literals/Trim.d.ts +0 -11
- package/dist/types/types/string-literals/TrimLeft.d.ts +0 -11
- package/dist/types/types/string-literals/TrimRight.d.ts +0 -11
- package/dist/types/types/string-literals/form-fields.d.ts +0 -12
- package/dist/types/types/string-literals/index.d.ts +0 -10
- package/dist/types/types/tuples/DictArray.d.ts +0 -19
- package/dist/types/types/tuples/FirstKey.d.ts +0 -8
- package/dist/types/types/tuples/FirstKeyValue.d.ts +0 -8
- package/dist/types/types/tuples/FirstOfEach.d.ts +0 -11
- package/dist/types/types/tuples/FromDictArray.d.ts +0 -10
- package/dist/types/types/tuples/SecondOfEach.d.ts +0 -10
- package/dist/types/types/tuples/index.d.ts +0 -6
- package/dist/types/types/type-conversion/TupleToUnion.d.ts +0 -10
- package/dist/types/types/type-conversion/UnionToIntersection.d.ts +0 -5
- package/dist/types/types/type-conversion/UnionToTuple.d.ts +0 -9
- package/dist/types/types/type-conversion/index.d.ts +0 -3
- package/dist/types/types/type-testing.d.ts +0 -13
- package/dist/types/utility/api/api.d.ts +0 -2
- package/dist/types/utility/api/index.d.ts +0 -1
- package/dist/types/utility/createFnWithProps.d.ts +0 -1
- package/dist/types/utility/dictionary/arrayToKeyLookup.d.ts +0 -9
- package/dist/types/utility/dictionary/dictFilter.d.ts +0 -8
- package/dist/types/utility/dictionary/dictionaryTransform.d.ts +0 -9
- package/dist/types/utility/dictionary/entries.d.ts +0 -17
- package/dist/types/utility/dictionary/index.d.ts +0 -8
- package/dist/types/utility/dictionary/kv/dictToKv.d.ts +0 -16
- package/dist/types/utility/dictionary/kv/filterDictArray.d.ts +0 -9
- package/dist/types/utility/dictionary/kv/index.d.ts +0 -4
- package/dist/types/utility/dictionary/kv/kv.d.ts +0 -10
- package/dist/types/utility/dictionary/kv/kvToDict.d.ts +0 -15
- package/dist/types/utility/dictionary/mapValues.d.ts +0 -13
- package/dist/types/utility/dictionary/strArrayToDict.d.ts +0 -6
- package/dist/types/utility/dictionary/valuesOfProp.d.ts +0 -1
- package/dist/types/utility/index.d.ts +0 -11
- package/dist/types/utility/keys.d.ts +0 -5
- package/dist/types/utility/lists/groupBy.d.ts +0 -12
- package/dist/types/utility/lists/index.d.ts +0 -1
- package/dist/types/utility/literals/ExplicitFunction.d.ts +0 -6
- package/dist/types/utility/literals/arrayToObject.d.ts +0 -41
- package/dist/types/utility/literals/defineType.d.ts +0 -8
- package/dist/types/utility/literals/identity.d.ts +0 -6
- package/dist/types/utility/literals/index.d.ts +0 -5
- package/dist/types/utility/literals/literal.d.ts +0 -41
- package/dist/types/utility/map-reduce/filter.d.ts +0 -26
- package/dist/types/utility/map-reduce/index.d.ts +0 -1
- package/dist/types/utility/modelling/Model.d.ts +0 -22
- package/dist/types/utility/modelling/index.d.ts +0 -1
- package/dist/types/utility/ruleset.d.ts +0 -18
- package/dist/types/utility/runtime/condition.d.ts +0 -3
- package/dist/types/utility/runtime/conditions/index.d.ts +0 -12
- package/dist/types/utility/runtime/conditions/isArray.d.ts +0 -2
- package/dist/types/utility/runtime/conditions/isBoolean.d.ts +0 -5
- package/dist/types/utility/runtime/conditions/isFalse.d.ts +0 -4
- package/dist/types/utility/runtime/conditions/isFunction.d.ts +0 -15
- package/dist/types/utility/runtime/conditions/isLiteral.d.ts +0 -2
- package/dist/types/utility/runtime/conditions/isNull.d.ts +0 -1
- package/dist/types/utility/runtime/conditions/isNumber.d.ts +0 -1
- package/dist/types/utility/runtime/conditions/isObject.d.ts +0 -10
- package/dist/types/utility/runtime/conditions/isString.d.ts +0 -2
- package/dist/types/utility/runtime/conditions/isSymbol.d.ts +0 -1
- package/dist/types/utility/runtime/conditions/isTrue.d.ts +0 -20
- package/dist/types/utility/runtime/conditions/isUndefined.d.ts +0 -1
- package/dist/types/utility/runtime/ifTypeOf.d.ts +0 -23
- package/dist/types/utility/runtime/index.d.ts +0 -5
- package/dist/types/utility/runtime/type.d.ts +0 -27
- package/dist/types/utility/runtime/withValue.d.ts +0 -19
- package/dist/types/utility/state/Configurator.d.ts +0 -36
- package/dist/types/utility/state/FluentConfigurator.d.ts +0 -27
- package/dist/types/utility/state/index.d.ts +0 -3
- package/src/errors/InferenceError.ts +0 -3
- package/src/errors/index.ts +0 -37
- package/src/types/alphabetic/Intrinsic.ts +0 -6
- package/tests/FluentApi-spec.ts +0 -90
- package/tests/FluentConfigurator-spec.hold +0 -88
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type { TypeCondition } from "../utility/runtime/ifTypeOf";
|
|
2
|
-
import { OptionalKeys } from "./props";
|
|
3
|
-
import { SameKeys } from "./SameKeys";
|
|
4
|
-
/**
|
|
5
|
-
* **RuleDefinition**
|
|
6
|
-
*
|
|
7
|
-
* A rule definition is the typing for the fluent API surface that is built up
|
|
8
|
-
* with the **ruleset** utility.
|
|
9
|
-
*/
|
|
10
|
-
export declare type RuleDefinition<
|
|
11
|
-
/** the data which will be evaluated on rule execution */
|
|
12
|
-
T extends object,
|
|
13
|
-
/** the optional props -- as a union type -- which must be defined per the rule */
|
|
14
|
-
H extends string = "",
|
|
15
|
-
/** the key/values which will be evaluated on execution (wide type) */
|
|
16
|
-
E extends Partial<SameKeys<T>> = {},
|
|
17
|
-
/** the key/values which will be evaluated on execution (narrow type) */
|
|
18
|
-
N extends Partial<SameKeys<T>> = {}> = {
|
|
19
|
-
/**
|
|
20
|
-
* sets up a true/false check that a given property is defined; this
|
|
21
|
-
* condition can only be applied to _optional_ properties.
|
|
22
|
-
*/
|
|
23
|
-
has(optProp: OptionalKeys<T>): RuleDefinition<T, H & typeof optProp, E, N>;
|
|
24
|
-
/**
|
|
25
|
-
* Validates that a given property extends a certain value's type; comparison
|
|
26
|
-
* is made assuming "wide types".
|
|
27
|
-
*/
|
|
28
|
-
equals<K extends keyof T, V extends Pick<T, K>>(prop: K, value: V): RuleDefinition<T, H, E & Record<K, V>, N>;
|
|
29
|
-
/**
|
|
30
|
-
* Validates that a given property extends a certain value's type; comparison
|
|
31
|
-
* is made assuming "narrow types". This is only available for props which
|
|
32
|
-
* expose a
|
|
33
|
-
*/
|
|
34
|
-
narrowlyEquals<K extends keyof T, V extends Pick<T, K>>(prop: K, value: V): RuleDefinition<T, H, E, N & Record<K, V>>;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* **DynamicRule**
|
|
38
|
-
*
|
|
39
|
-
* A dynamic rule allows type and runtime validation of a data structure
|
|
40
|
-
* which extends a known `State`. It then returns the literal type `true`
|
|
41
|
-
* or `false`.
|
|
42
|
-
*
|
|
43
|
-
* ```ts
|
|
44
|
-
* type State = { id?: string; favorite: boolean; color: string };
|
|
45
|
-
* // type-safe way to check whether optional prop is actually set
|
|
46
|
-
* const rule: DynamicRule<State> = s => s
|
|
47
|
-
* .has("id")
|
|
48
|
-
* .equals("favorite", true)
|
|
49
|
-
* .equals("color", "red");
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
export declare type DynamicRule<TState extends any, TResult extends true | false> = (rule: TypeCondition<any, TState>) => TResult;
|
|
53
|
-
/**
|
|
54
|
-
* **DynamicRuleSet**
|
|
55
|
-
*
|
|
56
|
-
* A function which accepts the agreed `TState` generic as input and returns a discrete
|
|
57
|
-
* `true` or `false` value.
|
|
58
|
-
*/
|
|
59
|
-
export declare type DynamicRuleSet<TState extends any, TRules extends Record<string, TypeCondition<any, TState>>> = (rules: TRules) => true | false;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { TypeGuard } from "./";
|
|
2
|
-
export declare type RuntimeType<T> = {
|
|
3
|
-
__kind: "type";
|
|
4
|
-
type: T;
|
|
5
|
-
is: TypeGuard<T>;
|
|
6
|
-
};
|
|
7
|
-
export declare type RuntimeProp<P extends Readonly<PropertyKey>, T extends RuntimeType<any>> = {
|
|
8
|
-
__kind: "prop";
|
|
9
|
-
key: Readonly<P>;
|
|
10
|
-
valueType: Readonly<T["type"]>;
|
|
11
|
-
/**
|
|
12
|
-
* Provides the _type_ to the type system when used with `typeof`.
|
|
13
|
-
*
|
|
14
|
-
* ```ts
|
|
15
|
-
* const t = number();
|
|
16
|
-
* // number
|
|
17
|
-
* type T = typeof t.type;
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* **Note:** _the runtime system will get a string equivalent name:_
|
|
21
|
-
* ```ts
|
|
22
|
-
* const t = number();
|
|
23
|
-
* // "number"
|
|
24
|
-
* console.log(t.type);
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
type: Record<P, T["type"]>;
|
|
28
|
-
is: TypeGuard<Record<P, T["type"]>>;
|
|
29
|
-
};
|
|
30
|
-
export declare type TypeOptions<T extends Partial<object> = {}> = {
|
|
31
|
-
/** each type has a default type guard but you can override if you need to be more specific */
|
|
32
|
-
typeGuard?: TypeGuard<T>;
|
|
33
|
-
} & T;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* **Break<T,D>**
|
|
3
|
-
*
|
|
4
|
-
* Takes a string `T`, and splits it into a tuple of the form `[F, R]`.
|
|
5
|
-
* ```ts
|
|
6
|
-
* // ["the", " long and winding road"]
|
|
7
|
-
* type T1 = Break<"the long and winding road", " ">;
|
|
8
|
-
* // ["there", " I was, there I was"]
|
|
9
|
-
* type T2 = Break<"there I was, there I was", " ">;
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
export declare type Break<T extends string, D extends string> = (string extends T ? [string, string] : (T extends `${infer F}${D}${infer _R}` ? (F extends `${infer _X}${D}${infer _Y}` ? never : (T extends `${F}${infer R}` ? [F, R] : never)) : [T, ""]));
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Replace, TrimLeft } from "..";
|
|
2
|
-
/**
|
|
3
|
-
* Provides the _left_ whitespace of a string
|
|
4
|
-
* ```ts
|
|
5
|
-
* // "\n\t "
|
|
6
|
-
* type T = LeftWhitespace<"\n\t foobar">;
|
|
7
|
-
* ```
|
|
8
|
-
*/
|
|
9
|
-
export declare type LeftWhitespace<S extends string> = string extends S ? string : Replace<S, TrimLeft<S>, "">;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type utility which takes a string `S` and replaces the substring `W` with `P`.
|
|
3
|
-
* ```ts
|
|
4
|
-
* const fooy = "fooy";
|
|
5
|
-
* // "Foo"
|
|
6
|
-
* type Foo = Replace<typeof fooy, "y", "">;
|
|
7
|
-
* ```
|
|
8
|
-
*
|
|
9
|
-
* Note: _the first match is replaced and all subsequent matches are ignored_
|
|
10
|
-
*/
|
|
11
|
-
export declare type Replace<S extends string, W extends string, P extends string> = S extends "" ? "" : W extends "" ? S : S extends `${infer F}${W}${infer E}` ? `${F}${P}${E}` : S;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Replace, TrimRight } from "..";
|
|
2
|
-
/**
|
|
3
|
-
* Provides the _left_ whitespace of a string
|
|
4
|
-
* ```ts
|
|
5
|
-
* // "\n\t "
|
|
6
|
-
* type T = LeftWhitespace<"\n\t foobar">;
|
|
7
|
-
* ```
|
|
8
|
-
*/
|
|
9
|
-
export declare type RightWhitespace<S extends string> = string extends S ? string : Replace<S, TrimRight<S>, "">;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type utility that provides the _length_ of a given string type in a way which
|
|
3
|
-
* is _not_ limited to TS's recursive string length of roughly 48.
|
|
4
|
-
*
|
|
5
|
-
* ```ts
|
|
6
|
-
* // 3
|
|
7
|
-
* type Three = StringLength<"foo">;
|
|
8
|
-
* ```
|
|
9
|
-
*/
|
|
10
|
-
export declare type StringLength<S extends string, R extends number[] = []> = S extends `${infer _First}${infer _Second}${infer _Third}${infer _Fourth}${infer _Fifth}${infer _Sixth}${infer _Sevebnth}${infer _Eighth}${infer _Ninth}${infer _Tenth}${infer Rest}` ? StringLength<Rest, [...R, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]> : S extends `${infer _First}${infer _Second}${infer _Third}${infer _Fourth}${infer _Fifth}${infer _Sixth}${infer _Sevebnth}${infer _Eighth}${infer _Ninth}${infer Rest}` ? StringLength<Rest, [...R, 1, 1, 1, 1, 1, 1, 1, 1, 1]> : S extends `${infer _First}${infer _Second}${infer _Third}${infer _Fourth}${infer _Fifth}${infer _Sixth}${infer _Sevebnth}${infer _Eighth}${infer Rest}` ? StringLength<Rest, [...R, 1, 1, 1, 1, 1, 1, 1, 1]> : S extends `${infer _First}${infer _Second}${infer _Third}${infer _Fourth}${infer _Fifth}${infer _Sixth}${infer _Sevebnth}${infer Rest}` ? StringLength<Rest, [...R, 1, 1, 1, 1, 1, 1, 1]> : S extends `${infer _First}${infer _Second}${infer _Third}${infer _Fourth}${infer _Fifth}${infer _Sixth}${infer Rest}` ? StringLength<Rest, [...R, 1, 1, 1, 1, 1, 1]> : S extends `${infer _First}${infer _Second}${infer _Third}${infer _Fourth}${infer _Fifth}}${infer Rest}` ? StringLength<Rest, [...R, 1, 1, 1, 1, 1]> : S extends `${infer _First}${infer _Second}${infer _Third}${infer _Fourth}${infer Rest}` ? StringLength<Rest, [...R, 1, 1, 1, 1]> : S extends `${infer _First}${infer _Second}${infer _Third}${infer Rest}` ? StringLength<Rest, [...R, 1, 1, 1]> : S extends `${infer _First}${infer _Second}${infer Rest}` ? StringLength<Rest, [...R, 1, 1]> : S extends `${infer _First}${infer Rest}` ? StringLength<Rest, [...R, 1]> : [...R]["length"];
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Whitespace } from "../alphabetic";
|
|
2
|
-
/**
|
|
3
|
-
* Trims off blank spaces, `\n` and `\t` characters from both sides of a _string literal_.
|
|
4
|
-
* ```ts
|
|
5
|
-
* // "foobar"
|
|
6
|
-
* type T = Trim<"\n\t foobar ">;
|
|
7
|
-
* // string
|
|
8
|
-
* type T = Trim<string>;
|
|
9
|
-
* ```
|
|
10
|
-
*/
|
|
11
|
-
export declare type Trim<S extends string> = string extends S ? string : S extends `${Whitespace}${infer Right}` ? Trim<Right> : S extends `${infer Left}${Whitespace}` ? Trim<Left> : S;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Whitespace } from "../alphabetic";
|
|
2
|
-
/**
|
|
3
|
-
* Trims off whitespace on left of string
|
|
4
|
-
* ```ts
|
|
5
|
-
* // "foobar "
|
|
6
|
-
* type T = TrimLeft<"\n\t foobar ">;
|
|
7
|
-
* // string
|
|
8
|
-
* type T = TrimLeft<string>;
|
|
9
|
-
* ```
|
|
10
|
-
*/
|
|
11
|
-
export declare type TrimLeft<S extends string> = string extends S ? string : S extends `${Whitespace}${infer Right}` ? TrimLeft<Right> : S;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Whitespace } from "../alphabetic";
|
|
2
|
-
/**
|
|
3
|
-
* Trims off whitespace on left of string
|
|
4
|
-
* ```ts
|
|
5
|
-
* // "\n foobar"
|
|
6
|
-
* type T = TrimRight<"\n foobar \t">;
|
|
7
|
-
* // string
|
|
8
|
-
* type T = TrimRight<string>;
|
|
9
|
-
* ```
|
|
10
|
-
*/
|
|
11
|
-
export declare type TrimRight<S extends string> = string extends S ? string : S extends `${infer Right}${Whitespace}` ? TrimRight<Right> : S;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { NumericString } from "../alphabetic/alpha-characters";
|
|
2
|
-
/**
|
|
3
|
-
* An email address
|
|
4
|
-
*/
|
|
5
|
-
export declare type Email = `${string}@${string}.${string}`;
|
|
6
|
-
declare type Zip5 = `${NumericString}${NumericString}${string}${NumericString}`;
|
|
7
|
-
declare type Zip4 = `${NumericString}${string}`;
|
|
8
|
-
/**
|
|
9
|
-
* A relatively strong type for Zip5 or Zip5+4 zip codes
|
|
10
|
-
*/
|
|
11
|
-
export declare type ZipCode = Zip5 | `${Zip5}-${Zip4}`;
|
|
12
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from "./Break";
|
|
2
|
-
export * from "./Concat";
|
|
3
|
-
export * from "./LeftWhitespace";
|
|
4
|
-
export * from "./Replace";
|
|
5
|
-
export * from "./RightWhitespace";
|
|
6
|
-
export * from "./StringLength";
|
|
7
|
-
export * from "./Trim";
|
|
8
|
-
export * from "./TrimLeft";
|
|
9
|
-
export * from "./TrimRight";
|
|
10
|
-
export * from "./form-fields";
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export declare type DictArrayFilterCallback<K extends keyof T, T extends object, R extends true | false> = (key: K, value: Pick<T, K>) => R;
|
|
2
|
-
/**
|
|
3
|
-
* An element in a `DictArray` shaped as a two element tuple: `[key, kv]`.
|
|
4
|
-
*/
|
|
5
|
-
export declare type DictArrayKv<K extends keyof T, T> = [K, Pick<T, K>];
|
|
6
|
-
export declare type DictKvTuple<K extends string> = [K, Record<K, unknown>];
|
|
7
|
-
/**
|
|
8
|
-
* A an array of `DictArrayKv` tuples which can be reconstructed
|
|
9
|
-
* to a strongly typed dictionary object.
|
|
10
|
-
* ```ts
|
|
11
|
-
* const example: DictArray<{ foo: 1, bar: "hi" }> = [
|
|
12
|
-
* [ "foo", { foo: 1 }],
|
|
13
|
-
* [ "bar", { bar: "hi" }]
|
|
14
|
-
* ]
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export declare type DictArray<T> = Array<{
|
|
18
|
-
[K in keyof T]: DictArrayKv<K, T>;
|
|
19
|
-
}[keyof T]>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Keys, UnionToTuple } from "..";
|
|
2
|
-
/**
|
|
3
|
-
* Returns the _first_ key in an object.
|
|
4
|
-
*
|
|
5
|
-
* **Note:** key order is not guarenteed so typically this is used
|
|
6
|
-
* for a key/value pair where only one key is expected
|
|
7
|
-
*/
|
|
8
|
-
export declare type FirstKey<T extends object> = UnionToTuple<Keys<T>>[0];
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { FirstKey } from "./FirstKey";
|
|
2
|
-
/**
|
|
3
|
-
* Utility type which operates on a dictionary and provides the **value** of the
|
|
4
|
-
* `First<T>` key of the dictionary. Because dictionary's don't provide assurances
|
|
5
|
-
* about key order, this is typically only used in cases where it's known there is
|
|
6
|
-
* a single key on the object.
|
|
7
|
-
*/
|
|
8
|
-
export declare type FirstKeyValue<T extends object> = FirstKey<T> extends keyof T ? T[FirstKey<T>] : never;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* For a two-dimensional array, returns a _union type_ which combines the first element of the interior
|
|
3
|
-
* array.
|
|
4
|
-
*
|
|
5
|
-
* ```ts
|
|
6
|
-
* const test = [ ["foo", 1], ["bar", 2] ];
|
|
7
|
-
* // "foo" | "bar"
|
|
8
|
-
* type F = FirstOfEach<typeof test>;
|
|
9
|
-
* ```
|
|
10
|
-
*/
|
|
11
|
-
export declare type FirstOfEach<T extends readonly any[][]> = T[number][0] extends T[number][number] ? T[number][0] : never;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ExpandRecursively, UnionToIntersection } from "..";
|
|
2
|
-
/**
|
|
3
|
-
* Typescript utility which recieves `T` as shape which resembles `DictArray<D>`
|
|
4
|
-
* and if the type `D` can be inferred it is returned.
|
|
5
|
-
* ```ts
|
|
6
|
-
* // { foo: 1; bar: "hi" }
|
|
7
|
-
* type Dict = FromDictArray<[["foo", { foo: 1 }], ["bar", { bar: "hi" }]]>;
|
|
8
|
-
* ```
|
|
9
|
-
*/
|
|
10
|
-
export declare type FromDictArray<T extends [string, Record<string, unknown>][]> = ExpandRecursively<UnionToIntersection<T[number][1]>>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* For a two-dimensional array, returns a _union type_ which combines the first element of the interior
|
|
3
|
-
* array.
|
|
4
|
-
*
|
|
5
|
-
* ```ts
|
|
6
|
-
* // 1 | 2
|
|
7
|
-
* type F = SecondOfEach<[ ["foo", 1], ["bar", 2] ]>;
|
|
8
|
-
* ```
|
|
9
|
-
*/
|
|
10
|
-
export declare type SecondOfEach<T extends any[][]> = T[number][1] extends T[number][number] ? T[number][1] : never;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Mutable } from "../Mutable";
|
|
2
|
-
/**
|
|
3
|
-
* Converts a Tuple type into a _union_ of the tuple elements
|
|
4
|
-
* ```ts
|
|
5
|
-
* const arr = [1, 3, 5] as const;
|
|
6
|
-
* // 1 | 3 | 5
|
|
7
|
-
* type U = TupleToUnion<typeof arr>;
|
|
8
|
-
* ```
|
|
9
|
-
*/
|
|
10
|
-
export declare type TupleToUnion<T> = Mutable<T> extends any[] ? Mutable<T>[number] : never;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { UnionToIntersection } from "./UnionToIntersection";
|
|
2
|
-
/**
|
|
3
|
-
* LastInUnion<1 | 2> = 2.
|
|
4
|
-
*/
|
|
5
|
-
export declare type LastInUnion<U> = UnionToIntersection<U extends unknown ? (x: U) => 0 : never> extends (x: infer L) => 0 ? L : never;
|
|
6
|
-
/**
|
|
7
|
-
* UnionToTuple<1 | 2> = [1, 2].
|
|
8
|
-
*/
|
|
9
|
-
export declare type UnionToTuple<U, Last = LastInUnion<U>> = [U] extends [never] ? [] : [...UnionToTuple<Exclude<U, Last>>, Last];
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Validates that a given type extends another and returns `true` or `false` type
|
|
3
|
-
*/
|
|
4
|
-
export declare type ExpectExtends<VALUE, EXPECTED> = EXPECTED extends VALUE ? true : false;
|
|
5
|
-
/**
|
|
6
|
-
* Validates that a given type extends another and returns `any` or `never` as a type
|
|
7
|
-
*/
|
|
8
|
-
export declare type AssertExtends<VALUE, EXPECTED> = EXPECTED extends VALUE ? any : never;
|
|
9
|
-
export declare type IfExtends<VALUE, EXPECTED> = EXPECTED extends VALUE ? VALUE : never;
|
|
10
|
-
/**
|
|
11
|
-
* Give a type `TValue` and a comparison type `TExtends`
|
|
12
|
-
*/
|
|
13
|
-
export declare type IfExtendsThen<VALUE, EXPECTED, THEN> = EXPECTED extends VALUE ? THEN : never;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./api";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function createFnWithProps<F extends Function, P extends {}>(fn: F, props: P): F & P;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Passing in an array of strings, you are passed back a dictionary with
|
|
3
|
-
* all the keys being the strings and values set to `true`.
|
|
4
|
-
* ```ts
|
|
5
|
-
* // { foo: true, bar: true }
|
|
6
|
-
* const fooBar = arrayToKeyLookup("foo", "bar");
|
|
7
|
-
* ```
|
|
8
|
-
*/
|
|
9
|
-
export declare function arrayToKeyLookup<T extends readonly string[]>(...keys: T): Record<T[number], true>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Narrowable } from "../../types";
|
|
2
|
-
export declare type ObjFilterCallback<T extends object, R extends boolean> = (k: keyof T, state: T) => R;
|
|
3
|
-
/**
|
|
4
|
-
* **dictFilter**
|
|
5
|
-
*
|
|
6
|
-
* Provides a means ot filter down the properties on a given object.
|
|
7
|
-
*/
|
|
8
|
-
export declare function dictFilter<N extends Narrowable, T extends Record<string, N>, R extends boolean>(obj: T, cb: ObjFilterCallback<T, R>): Exclude<T, (keyof T)[]>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { SameKeys, Transformer } from "../../types";
|
|
2
|
-
/**
|
|
3
|
-
* Takes a dictionary of type `I` and converts it to a dictionary of type `O` where
|
|
4
|
-
* they _keys_ used in both dictionaries are the same.
|
|
5
|
-
*
|
|
6
|
-
* The _transform_ function passed in must be able to recieve the full input object
|
|
7
|
-
* and key, and then return expected value of `O` for the given key.
|
|
8
|
-
*/
|
|
9
|
-
export declare function dictionaryTransform<I extends object, O extends SameKeys<I>>(input: I, transform: Transformer<I, O>): O;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { KeyValue, Narrowable } from "../../types";
|
|
2
|
-
/**
|
|
3
|
-
* **entries**
|
|
4
|
-
*
|
|
5
|
-
* Provides an _interable_ over the passed in dictionary object where each iteration
|
|
6
|
-
* provides a tuple of `[ key, value ]` which preserve type literals.
|
|
7
|
-
*
|
|
8
|
-
* For example:
|
|
9
|
-
* ```ts
|
|
10
|
-
* const obj = { foo: 1, bar: "hi" };
|
|
11
|
-
* // k type is "foo" then "bar"; v type is 1 then "hi"
|
|
12
|
-
* for (const [k, v] of entries(obj)) { ... }
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
export declare function entries<N extends Narrowable, T extends Record<string, N>, I extends KeyValue<T, keyof T>>(obj: T): {
|
|
16
|
-
[Symbol.iterator](): Generator<I, void, unknown>;
|
|
17
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from "./arrayToKeyLookup";
|
|
2
|
-
export * from "./dictFilter";
|
|
3
|
-
export * from "./dictionaryTransform";
|
|
4
|
-
export * from "./entries";
|
|
5
|
-
export * from "./mapValues";
|
|
6
|
-
export * from "./strArrayToDict";
|
|
7
|
-
export * from "./valuesOfProp";
|
|
8
|
-
export * from "./kv/index";
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Mutable, Narrowable, UnionToTuple } from "../../../types";
|
|
2
|
-
import { KvFrom } from "../../../types/kv/KvFrom";
|
|
3
|
-
/**
|
|
4
|
-
* Converts a dictionary object into an array of dictionaries with `key` and `value` properties
|
|
5
|
-
* ```ts
|
|
6
|
-
* // [ { key: "id", value: 123 }, { key: "foo", value: "bar" } ]
|
|
7
|
-
* const arr = dictToKv({ id: 123, foo: "bar" });
|
|
8
|
-
* ```
|
|
9
|
-
*/
|
|
10
|
-
export declare function dictToKv<N extends Narrowable, T extends Record<string, N>, U extends boolean>(obj: T, _makeTuple?: U): U extends true ? UnionToTuple<{ [K in keyof Mutable<T>]: {
|
|
11
|
-
key: K;
|
|
12
|
-
value: Mutable<T>[K];
|
|
13
|
-
}; }[keyof T], import("../../../types").LastInUnion<{ [K in keyof Mutable<T>]: {
|
|
14
|
-
key: K;
|
|
15
|
-
value: Mutable<T>[K];
|
|
16
|
-
}; }[keyof T]>> : KvFrom<Mutable<T>>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { DictArray, DictArrayFilterCallback } from "../../../types";
|
|
2
|
-
export interface Array<T> {
|
|
3
|
-
filter<U extends T>(pred: (a: T) => a is U): U[];
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Accepts a `DictArray` and a callback which receives each key
|
|
7
|
-
* value pair.
|
|
8
|
-
*/
|
|
9
|
-
export declare function filterDictArray<T extends object, C extends DictArrayFilterCallback<keyof T, T, true | false>>(dictArr: DictArray<T>, cb: C): DictArray<Omit<T, "">>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ExpandRecursively, Narrowable } from "../../../types";
|
|
2
|
-
/**
|
|
3
|
-
* Build a key-value pair where both _key_ and _value_ are inferred. This
|
|
4
|
-
* includes ensuring that the _key_ is a type literal not just a "string".
|
|
5
|
-
*
|
|
6
|
-
* > note: the value will be inferred but if you need to constrain it
|
|
7
|
-
* > to a narrower type then both inferrences will break and you should
|
|
8
|
-
* > instead use `KV2` to get this capability.
|
|
9
|
-
*/
|
|
10
|
-
export declare function kv<K extends string, N extends Narrowable, V extends Record<any, N> | boolean | number | string | null | undefined>(key: K, value: V): ExpandRecursively<Record<K, V>>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Narrowable } from "../../../types";
|
|
2
|
-
import { DictFromKv } from "../../../types/kv";
|
|
3
|
-
/**
|
|
4
|
-
* Converts an array of dictionaries with `key` and `value` properties to a singular dictionary.
|
|
5
|
-
* ```ts
|
|
6
|
-
* // { id: 123, foo: "bar" }
|
|
7
|
-
* const arr = kvToDict([{ key: "id", value: 123 }, { key: "foo", value: "bar" }]);
|
|
8
|
-
* ```
|
|
9
|
-
*
|
|
10
|
-
* Note: this is the inverse of `dictToKv()` function
|
|
11
|
-
*/
|
|
12
|
-
export declare function kvToDict<K extends string, V extends Narrowable, T extends readonly Readonly<{
|
|
13
|
-
key: K;
|
|
14
|
-
value: V;
|
|
15
|
-
}>[]>(kvArr: T): DictFromKv<T>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Narrowable } from "../../types";
|
|
2
|
-
/**
|
|
3
|
-
* **mapValues**
|
|
4
|
-
*
|
|
5
|
-
* Maps over a dictionary, preserving the keys but allowing the values to be mutated.
|
|
6
|
-
*
|
|
7
|
-
* ```ts
|
|
8
|
-
* const colors = { red: 4, blue: 2, green: 3 };
|
|
9
|
-
* // { red: 8, blue: 4, green: 6 }
|
|
10
|
-
* const twoX = mapValues(colors, v => v * 2);
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
export declare function mapValues<N extends Narrowable, T extends Record<string, N>, V>(obj: T, valueMapper: (k: T[keyof T]) => V): { [K in keyof T]: V; };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ExpandRecursively } from "../../types/ExpandRecursively";
|
|
2
|
-
/**
|
|
3
|
-
* converts an array of strings `["a", "b", "c"]` into a more type friendly
|
|
4
|
-
* dictionary of the type `{ a: true, b: true, c: true }`
|
|
5
|
-
*/
|
|
6
|
-
export declare function strArrayToDict<T extends readonly string[]>(...strings: T): ExpandRecursively<Record<T[number], true>>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function valuesOfProp<_T extends object>(): void;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export * from "./createFnWithProps";
|
|
2
|
-
export * from "./keys";
|
|
3
|
-
export * from "./ruleset";
|
|
4
|
-
export * from "./api/index";
|
|
5
|
-
export * from "./dictionary/index";
|
|
6
|
-
export * from "./lists/index";
|
|
7
|
-
export * from "./literals/index";
|
|
8
|
-
export * from "./map-reduce/index";
|
|
9
|
-
export * from "./modelling/index";
|
|
10
|
-
export * from "./runtime/index";
|
|
11
|
-
export * from "./state/index";
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Keys, Length } from "../types";
|
|
2
|
-
/**
|
|
3
|
-
* Provides the _keys_ of an object with the `keyof T` made explicit.
|
|
4
|
-
*/
|
|
5
|
-
export declare function keys<T extends {}, W extends readonly string[]>(obj: T, ...without: W): Length<W> extends 0 ? (keyof T)[] : Exclude<keyof T, Keys<W, undefined>>[];
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Narrowable } from "../../types";
|
|
2
|
-
/**
|
|
3
|
-
* Groups an array of data based on the value of a property
|
|
4
|
-
* in the objects within the array.
|
|
5
|
-
* ```ts
|
|
6
|
-
* const data = [ {}, {}, {} ];
|
|
7
|
-
*
|
|
8
|
-
* ```
|
|
9
|
-
*
|
|
10
|
-
* @ignore not implemented
|
|
11
|
-
*/
|
|
12
|
-
export declare function groupBy<T extends Record<string, Narrowable>, K extends keyof T & string>(_data: Readonly<T[]>): (_groupBy: K) => void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./groupBy";
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare type ExplicitFunction<P extends any[], R extends any> = (...args: P) => R;
|
|
2
|
-
/**
|
|
3
|
-
* Takes a given function and converts it to an explicit representation
|
|
4
|
-
* where the generics represent the _parameter_ and _return_ typings.
|
|
5
|
-
*/
|
|
6
|
-
export declare function ExplicitFunction<T extends (...args: any[]) => any>(fn: T): ExplicitFunction<Parameters<T>, ReturnType<T>>;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Narrowable } from "../../types/Narrowable";
|
|
2
|
-
/**
|
|
3
|
-
* **UniqueDictionary**
|
|
4
|
-
*
|
|
5
|
-
* A dictionary converted by `arrayToObject()` which expects each key `S` to have a only a
|
|
6
|
-
* single/unique value.
|
|
7
|
-
*/
|
|
8
|
-
export declare type UniqueDictionary<S extends PropertyKey, N extends Narrowable, T extends Record<keyof T, N> & Record<S, any>> = {
|
|
9
|
-
[V in T as V[S]]: V;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* **GeneralDictionary**
|
|
13
|
-
*
|
|
14
|
-
* A dictionary converted by `arrayToObject()` which expects each key `S` to have an
|
|
15
|
-
* array of values.
|
|
16
|
-
*/
|
|
17
|
-
export declare type GeneralDictionary<S extends PropertyKey, N extends Narrowable, T extends Record<keyof T, N> & Record<S, any>> = {
|
|
18
|
-
[V in T as V[S]]: V[];
|
|
19
|
-
};
|
|
20
|
-
export declare type ArrayConverter<S extends PropertyKey, U extends boolean> =
|
|
21
|
-
/**
|
|
22
|
-
* An `ArrayConverter` is the partial application of the `arrayToObject()`
|
|
23
|
-
* utility. At this point, the configuration is setup already and all that's
|
|
24
|
-
* left is to pass in an array of objects.
|
|
25
|
-
*/
|
|
26
|
-
<N extends Narrowable, T extends Record<keyof T, N> & Record<S, any>>(arr: readonly T[]) => true extends U ? UniqueDictionary<S, N, T> : GeneralDictionary<S, N, T>;
|
|
27
|
-
/**
|
|
28
|
-
* Converts an array of objects into a dictionary by picking a property name contained
|
|
29
|
-
* by all objects and using that as the key to the dictionary.
|
|
30
|
-
*
|
|
31
|
-
* ```ts
|
|
32
|
-
* const arr = [
|
|
33
|
-
* { kind: "color", favorite: "blue", likes: 100 },
|
|
34
|
-
* { kind: "song", favorite: "some song", likes: 25 }
|
|
35
|
-
* ];
|
|
36
|
-
* const dict = arrayToObject("kind")(arr);
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* This will produce a dictionary with keys of `color` and `song`.
|
|
40
|
-
*/
|
|
41
|
-
export declare function arrayToObject<S extends PropertyKey, U extends boolean>(prop: S, unique?: U): ArrayConverter<S, true extends U ? true : false>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ExpandRecursively, Narrowable } from "../../types";
|
|
2
|
-
/**
|
|
3
|
-
* Build a _type_ from two run-time dictionaries.
|
|
4
|
-
*
|
|
5
|
-
* 1. The _first_ -- which is optional -- is interpreted as a _literal_ type definition
|
|
6
|
-
* 2. The _second_ dictionary is interpreted as a "wide" definition of prop types
|
|
7
|
-
*/
|
|
8
|
-
export declare function defineType<N extends Narrowable, TLiteral extends Record<string, N>>(literal?: TLiteral): <TWide extends object>(wide?: TWide) => ExpandRecursively<TWide & TLiteral>;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Narrowable } from "../../types/Narrowable";
|
|
2
|
-
/**
|
|
3
|
-
* An identity function for any type, with the goal of preserving literal type information
|
|
4
|
-
* whereever possible.
|
|
5
|
-
*/
|
|
6
|
-
export declare const identity: <N extends Narrowable, T extends string | number | boolean | symbol | Record<any, N> | null | undefined>(v: T) => T;
|