@thi.ng/api
Advanced tools
Comparing version 8.5.1 to 8.6.0
@@ -5,3 +5,3 @@ import type { Fn } from "./fn.js"; | ||
*/ | ||
export declare type Pair<K, V> = [K, V]; | ||
export type Pair<K, V> = [K, V]; | ||
/** | ||
@@ -8,0 +8,0 @@ * @param K - key type |
# Change Log | ||
- **Last updated**: 2022-11-30T22:27:37Z | ||
- **Last updated**: 2022-12-16T12:52:25Z | ||
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub) | ||
@@ -12,2 +12,8 @@ | ||
## [8.6.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/api@8.6.0) (2022-12-16) | ||
#### 🚀 Features | ||
- add SomeRequired type alias ([ff28e71](https://github.com/thi-ng/umbrella/commit/ff28e71)) | ||
## [8.5.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/api@8.5.0) (2022-11-28) | ||
@@ -14,0 +20,0 @@ |
@@ -12,3 +12,3 @@ import type { Fn2 } from "./fn.js"; | ||
*/ | ||
export declare type Comparator<T> = Fn2<T, T, number>; | ||
export type Comparator<T> = Fn2<T, T, number>; | ||
/** | ||
@@ -15,0 +15,0 @@ * Generic interface to compare value types. |
@@ -11,7 +11,7 @@ import type { IObjectOf } from "./object.js"; | ||
} | ||
export declare type MaybeDeref<T> = IDeref<T> | T; | ||
export type MaybeDeref<T> = IDeref<T> | T; | ||
/** | ||
* If `T` is a {@link IDeref}, returns its value type or else `T`. | ||
*/ | ||
export declare type Derefed<T> = T extends IDeref<any> ? ReturnType<T["deref"]> : T; | ||
export type Derefed<T> = T extends IDeref<any> ? ReturnType<T["deref"]> : T; | ||
/** | ||
@@ -36,3 +36,3 @@ * Constructs a type with a set of properties `K` of type `T` and | ||
*/ | ||
export declare type DerefedKeys<T extends IObjectOf<any>, K extends keyof T = keyof T> = { | ||
export type DerefedKeys<T extends IObjectOf<any>, K extends keyof T = keyof T> = { | ||
[P in K]: Derefed<T[P]>; | ||
@@ -39,0 +39,0 @@ }; |
@@ -6,3 +6,3 @@ import type { Fn } from "./fn.js"; | ||
*/ | ||
export declare type Listener = Fn<Event, void>; | ||
export type Listener = Fn<Event, void>; | ||
export interface Event extends IID<PropertyKey> { | ||
@@ -9,0 +9,0 @@ target?: any; |
86
fn.d.ts
/** | ||
* A no-arg function, returning T. | ||
*/ | ||
export declare type Fn0<T> = () => T; | ||
export type Fn0<T> = () => T; | ||
/** | ||
* A single arg function from A to B. | ||
*/ | ||
export declare type Fn<A, B> = (a: A) => B; | ||
export type Fn<A, B> = (a: A) => B; | ||
/** | ||
* A 2-arg function from A,B to C. | ||
*/ | ||
export declare type Fn2<A, B, C> = (a: A, b: B) => C; | ||
export type Fn2<A, B, C> = (a: A, b: B) => C; | ||
/** | ||
* A 3-arg function from A,B,C to D. | ||
*/ | ||
export declare type Fn3<A, B, C, D> = (a: A, b: B, c: C) => D; | ||
export type Fn3<A, B, C, D> = (a: A, b: B, c: C) => D; | ||
/** | ||
* A 4-arg function from A,B,C,D to E. | ||
*/ | ||
export declare type Fn4<A, B, C, D, E> = (a: A, b: B, c: C, d: D) => E; | ||
export type Fn4<A, B, C, D, E> = (a: A, b: B, c: C, d: D) => E; | ||
/** | ||
* A 5-arg function from A,B,C,D,E to F. | ||
*/ | ||
export declare type Fn5<A, B, C, D, E, F> = (a: A, b: B, c: C, d: D, e: E) => F; | ||
export type Fn5<A, B, C, D, E, F> = (a: A, b: B, c: C, d: D, e: E) => F; | ||
/** | ||
* A 6-arg function from A,B,C,D,E,F to G. | ||
*/ | ||
export declare type Fn6<A, B, C, D, E, F, G> = (a: A, b: B, c: C, d: D, e: E, f: F) => G; | ||
export type Fn6<A, B, C, D, E, F, G> = (a: A, b: B, c: C, d: D, e: E, f: F) => G; | ||
/** | ||
* A 7-arg function from A,B,C,D,E,F,G to H. | ||
*/ | ||
export declare type Fn7<A, B, C, D, E, F, G, H> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G) => H; | ||
export type Fn7<A, B, C, D, E, F, G, H> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G) => H; | ||
/** | ||
* A 8-arg function from A,B,C,D,E,F,G,H to I. | ||
*/ | ||
export declare type Fn8<A, B, C, D, E, F, G, H, I> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H) => I; | ||
export type Fn8<A, B, C, D, E, F, G, H, I> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H) => I; | ||
/** | ||
* A 9-arg function from A,B,C,D,E,F,G,H,I to J. | ||
*/ | ||
export declare type Fn9<A, B, C, D, E, F, G, H, I, J> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I) => J; | ||
export type Fn9<A, B, C, D, E, F, G, H, I, J> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I) => J; | ||
/** | ||
* A 10-arg function from A,B,C,D,E,F,G,H,I,J to K. | ||
*/ | ||
export declare type Fn10<A, B, C, D, E, F, G, H, I, J, K> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J) => K; | ||
export declare type FnO<A, B> = (a: A, ...xs: any[]) => B; | ||
export declare type FnO2<A, B, C> = (a: A, b: B, ...xs: any[]) => C; | ||
export declare type FnO3<A, B, C, D> = (a: A, b: B, c: C, ...xs: any[]) => D; | ||
export declare type FnO4<A, B, C, D, E> = (a: A, b: B, c: C, d: D, ...xs: any[]) => E; | ||
export declare type FnO5<A, B, C, D, E, F> = (a: A, b: B, c: C, d: D, e: E, ...xs: any[]) => F; | ||
export declare type FnO6<A, B, C, D, E, F, G> = (a: A, b: B, c: C, d: D, e: E, f: F, ...xs: any[]) => G; | ||
export declare type FnO7<A, B, C, D, E, F, G, H> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, ...xs: any[]) => H; | ||
export declare type FnO8<A, B, C, D, E, F, G, H, I> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, ...xs: any[]) => I; | ||
export declare type FnO9<A, B, C, D, E, F, G, H, I, J> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, ...xs: any[]) => J; | ||
export declare type FnO10<A, B, C, D, E, F, G, H, I, J, K> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, ...xs: any[]) => K; | ||
export type Fn10<A, B, C, D, E, F, G, H, I, J, K> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J) => K; | ||
export type FnO<A, B> = (a: A, ...xs: any[]) => B; | ||
export type FnO2<A, B, C> = (a: A, b: B, ...xs: any[]) => C; | ||
export type FnO3<A, B, C, D> = (a: A, b: B, c: C, ...xs: any[]) => D; | ||
export type FnO4<A, B, C, D, E> = (a: A, b: B, c: C, d: D, ...xs: any[]) => E; | ||
export type FnO5<A, B, C, D, E, F> = (a: A, b: B, c: C, d: D, e: E, ...xs: any[]) => F; | ||
export type FnO6<A, B, C, D, E, F, G> = (a: A, b: B, c: C, d: D, e: E, f: F, ...xs: any[]) => G; | ||
export type FnO7<A, B, C, D, E, F, G, H> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, ...xs: any[]) => H; | ||
export type FnO8<A, B, C, D, E, F, G, H, I> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, ...xs: any[]) => I; | ||
export type FnO9<A, B, C, D, E, F, G, H, I, J> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, ...xs: any[]) => J; | ||
export type FnO10<A, B, C, D, E, F, G, H, I, J, K> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, ...xs: any[]) => K; | ||
/** | ||
* An untyped vararg arg function to type T. | ||
*/ | ||
export declare type FnAny<T> = (...xs: any[]) => T; | ||
export type FnAny<T> = (...xs: any[]) => T; | ||
/** | ||
* A typed vararg arg function from A to B. | ||
*/ | ||
export declare type FnAnyT<A, B> = (...xs: A[]) => B; | ||
export type FnAnyT<A, B> = (...xs: A[]) => B; | ||
/** | ||
@@ -67,3 +67,3 @@ * 1-arg function with arg of type A and return type B (defaults | ||
*/ | ||
export declare type FnU<A, B = A> = Fn<A, B>; | ||
export type FnU<A, B = A> = Fn<A, B>; | ||
/** | ||
@@ -73,3 +73,3 @@ * 2-arg function with all args uniformly of type A and return type B (defaults | ||
*/ | ||
export declare type FnU2<A, B = A> = Fn2<A, A, B>; | ||
export type FnU2<A, B = A> = Fn2<A, A, B>; | ||
/** | ||
@@ -79,3 +79,3 @@ * 3-arg function with all args uniformly of type A and return type B (defaults | ||
*/ | ||
export declare type FnU3<A, B = A> = Fn3<A, A, A, B>; | ||
export type FnU3<A, B = A> = Fn3<A, A, A, B>; | ||
/** | ||
@@ -85,3 +85,3 @@ * 4-arg function with all args uniformly of type A and return type B (defaults | ||
*/ | ||
export declare type FnU4<A, B = A> = Fn4<A, A, A, A, B>; | ||
export type FnU4<A, B = A> = Fn4<A, A, A, A, B>; | ||
/** | ||
@@ -91,3 +91,3 @@ * 5-arg function with all args uniformly of type A and return type B (defaults | ||
*/ | ||
export declare type FnU5<A, B = A> = Fn5<A, A, A, A, A, B>; | ||
export type FnU5<A, B = A> = Fn5<A, A, A, A, A, B>; | ||
/** | ||
@@ -97,3 +97,3 @@ * 6-arg function with all args uniformly of type A and return type B (defaults | ||
*/ | ||
export declare type FnU6<A, B = A> = Fn6<A, A, A, A, A, A, B>; | ||
export type FnU6<A, B = A> = Fn6<A, A, A, A, A, A, B>; | ||
/** | ||
@@ -103,3 +103,3 @@ * 7-arg function with all args uniformly of type A and return type B (defaults | ||
*/ | ||
export declare type FnU7<A, B = A> = Fn7<A, A, A, A, A, A, A, B>; | ||
export type FnU7<A, B = A> = Fn7<A, A, A, A, A, A, A, B>; | ||
/** | ||
@@ -109,3 +109,3 @@ * 8-arg function with all args uniformly of type A and return type B (defaults | ||
*/ | ||
export declare type FnU8<A, B = A> = Fn8<A, A, A, A, A, A, A, A, B>; | ||
export type FnU8<A, B = A> = Fn8<A, A, A, A, A, A, A, A, B>; | ||
/** | ||
@@ -115,3 +115,3 @@ * 9-arg function with all args uniformly of type A and return type B (defaults | ||
*/ | ||
export declare type FnU9<A, B = A> = Fn9<A, A, A, A, A, A, A, A, A, B>; | ||
export type FnU9<A, B = A> = Fn9<A, A, A, A, A, A, A, A, A, B>; | ||
/** | ||
@@ -121,13 +121,13 @@ * 10-arg function with all args uniformly of type A and return type B (defaults | ||
*/ | ||
export declare type FnU10<A, B = A> = Fn10<A, A, A, A, A, A, A, A, A, A, B>; | ||
export declare type FnN = FnU<number>; | ||
export declare type FnN2 = FnU2<number>; | ||
export declare type FnN3 = FnU3<number>; | ||
export declare type FnN4 = FnU4<number>; | ||
export declare type FnN5 = FnU5<number>; | ||
export declare type FnN6 = FnU6<number>; | ||
export declare type FnN7 = FnU7<number>; | ||
export declare type FnN8 = FnU8<number>; | ||
export declare type FnN9 = FnU9<number>; | ||
export declare type FnN10 = FnU10<number>; | ||
export type FnU10<A, B = A> = Fn10<A, A, A, A, A, A, A, A, A, A, B>; | ||
export type FnN = FnU<number>; | ||
export type FnN2 = FnU2<number>; | ||
export type FnN3 = FnU3<number>; | ||
export type FnN4 = FnU4<number>; | ||
export type FnN5 = FnU5<number>; | ||
export type FnN6 = FnU6<number>; | ||
export type FnN7 = FnU7<number>; | ||
export type FnN8 = FnU8<number>; | ||
export type FnN9 = FnU9<number>; | ||
export type FnN10 = FnU10<number>; | ||
//# sourceMappingURL=fn.d.ts.map |
import type { Head, Tail } from "./tuple.js"; | ||
/** | ||
* A version of `T` in which only keys in K are mandatory and the rest are | ||
* considered optional. | ||
*/ | ||
export type SomeRequired<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K>>; | ||
/** | ||
* Extracts from A all keys which have values assignable to type B. | ||
*/ | ||
export declare type TypedKeys<A, B> = { | ||
export type TypedKeys<A, B> = { | ||
[P in Keys<A>]: B extends A[P] ? P : never; | ||
}[keyof A]; | ||
export declare type NumericKeys<T> = TypedKeys<T, number>; | ||
export declare type StringKeys<T> = TypedKeys<T, string>; | ||
export declare type DeepPartial<T> = Partial<{ | ||
export type NumericKeys<T> = TypedKeys<T, number>; | ||
export type StringKeys<T> = TypedKeys<T, string>; | ||
export type DeepPartial<T> = Partial<{ | ||
[k in keyof T]: DeepPartial<T[k]>; | ||
}>; | ||
export declare type Keys<T> = keyof Required<T>; | ||
export declare type Keys1<T, A extends Keys<T>> = Keys<Required<T>[A]>; | ||
export declare type Keys2<T, A extends Keys<T>, B extends Keys1<T, A>> = Keys1<Required<T>[A], B>; | ||
export declare type Keys3<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>> = Keys2<Required<T>[A], B, C>; | ||
export declare type Keys4<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>> = Keys3<Required<T>[A], B, C, D>; | ||
export declare type Keys5<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>> = Keys4<Required<T>[A], B, C, D, E>; | ||
export declare type Keys6<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>> = Keys5<Required<T>[A], B, C, D, E, F>; | ||
export declare type Keys7<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, G extends Keys6<T, A, B, C, D, E, F>> = Keys6<Required<T>[A], B, C, D, E, F, G>; | ||
export declare type Keys8<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, G extends Keys6<T, A, B, C, D, E, F>, H extends Keys7<T, A, B, C, D, E, F, G>> = Keys7<Required<T>[A], B, C, D, E, F, G, H>; | ||
export type Keys<T> = keyof Required<T>; | ||
export type Keys1<T, A extends Keys<T>> = Keys<Required<T>[A]>; | ||
export type Keys2<T, A extends Keys<T>, B extends Keys1<T, A>> = Keys1<Required<T>[A], B>; | ||
export type Keys3<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>> = Keys2<Required<T>[A], B, C>; | ||
export type Keys4<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>> = Keys3<Required<T>[A], B, C, D>; | ||
export type Keys5<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>> = Keys4<Required<T>[A], B, C, D, E>; | ||
export type Keys6<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>> = Keys5<Required<T>[A], B, C, D, E, F>; | ||
export type Keys7<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, G extends Keys6<T, A, B, C, D, E, F>> = Keys6<Required<T>[A], B, C, D, E, F, G>; | ||
export type Keys8<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, G extends Keys6<T, A, B, C, D, E, F>, H extends Keys7<T, A, B, C, D, E, F, G>> = Keys7<Required<T>[A], B, C, D, E, F, G, H>; | ||
/** | ||
@@ -31,3 +36,3 @@ * Internal type used as a reducer for the KeyN type. | ||
*/ | ||
declare type KeysNReducer<T, L, R extends unknown[]> = L extends keyof T ? { | ||
type KeysNReducer<T, L, R extends unknown[]> = L extends keyof T ? { | ||
0: keyof Required<T>[L]; | ||
@@ -39,11 +44,11 @@ 1: KeysNReducer<Required<T>[L], Head<R>, Tail<R>>; | ||
*/ | ||
export declare type KeysN<T, L extends unknown[]> = L extends [] ? Keys<T> : KeysNReducer<T, Head<L>, Tail<L>>; | ||
export declare type Val1<T, A extends Keys<T>> = T[A]; | ||
export declare type Val2<T, A extends Keys<T>, B extends Keys1<T, A>> = ValN<T, [A, B]>; | ||
export declare type Val3<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>> = ValN<T, [A, B, C]>; | ||
export declare type Val4<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>> = ValN<T, [A, B, C, D]>; | ||
export declare type Val5<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>> = ValN<T, [A, B, C, D, E]>; | ||
export declare type Val6<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>> = ValN<T, [A, B, C, D, E, F]>; | ||
export declare type Val7<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, G extends Keys6<T, A, B, C, D, E, F>> = ValN<T, [A, B, C, D, E, F, G]>; | ||
export declare type Val8<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, G extends Keys6<T, A, B, C, D, E, F>, H extends Keys7<T, A, B, C, D, E, F, G>> = ValN<T, [A, B, C, D, E, F, G, H]>; | ||
export type KeysN<T, L extends unknown[]> = L extends [] ? Keys<T> : KeysNReducer<T, Head<L>, Tail<L>>; | ||
export type Val1<T, A extends Keys<T>> = T[A]; | ||
export type Val2<T, A extends Keys<T>, B extends Keys1<T, A>> = ValN<T, [A, B]>; | ||
export type Val3<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>> = ValN<T, [A, B, C]>; | ||
export type Val4<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>> = ValN<T, [A, B, C, D]>; | ||
export type Val5<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>> = ValN<T, [A, B, C, D, E]>; | ||
export type Val6<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>> = ValN<T, [A, B, C, D, E, F]>; | ||
export type Val7<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, G extends Keys6<T, A, B, C, D, E, F>> = ValN<T, [A, B, C, D, E, F, G]>; | ||
export type Val8<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, G extends Keys6<T, A, B, C, D, E, F>, H extends Keys7<T, A, B, C, D, E, F, G>> = ValN<T, [A, B, C, D, E, F, G, H]>; | ||
/** | ||
@@ -58,3 +63,3 @@ * Internal reducer for ValN. | ||
*/ | ||
declare type ValNReducer<T, C, R extends unknown[]> = C extends keyof T ? { | ||
type ValNReducer<T, C, R extends unknown[]> = C extends keyof T ? { | ||
0: T[C]; | ||
@@ -66,26 +71,26 @@ 1: ValNReducer<Required<T>[C], Head<R>, Tail<R>>; | ||
*/ | ||
export declare type ValN<T, L extends unknown[]> = L extends [] ? T : ValNReducer<T, Head<L>, Tail<L>>; | ||
export type ValN<T, L extends unknown[]> = L extends [] ? T : ValNReducer<T, Head<L>, Tail<L>>; | ||
/** | ||
* Utilities for constructing types with nested keys removed. | ||
*/ | ||
export declare type Without<T, A extends Keys<T>> = Omit<T, A>; | ||
export declare type Without2<T, A extends Keys<T>, B extends Keys1<T, A>> = Without<T, A> & { | ||
export type Without<T, A extends Keys<T>> = Omit<T, A>; | ||
export type Without2<T, A extends Keys<T>, B extends Keys1<T, A>> = Without<T, A> & { | ||
[id in A]: Without<Val1<T, A>, B>; | ||
}; | ||
export declare type Without3<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>> = Without<T, A> & { | ||
export type Without3<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>> = Without<T, A> & { | ||
[id in A]: Without2<Val1<T, A>, B, C>; | ||
}; | ||
export declare type Without4<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>> = Without<T, A> & { | ||
export type Without4<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>> = Without<T, A> & { | ||
[id in A]: Without3<Val1<T, A>, B, C, D>; | ||
}; | ||
export declare type Without5<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>> = Without<T, A> & { | ||
export type Without5<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>> = Without<T, A> & { | ||
[id in A]: Without4<Val1<T, A>, B, C, D, E>; | ||
}; | ||
export declare type Without6<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>> = Without<T, A> & { | ||
export type Without6<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>> = Without<T, A> & { | ||
[id in A]: Without5<Val1<T, A>, B, C, D, E, F>; | ||
}; | ||
export declare type Without7<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, G extends Keys6<T, A, B, C, D, E, F>> = Without<T, A> & { | ||
export type Without7<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, G extends Keys6<T, A, B, C, D, E, F>> = Without<T, A> & { | ||
[id in A]: Without6<Val1<T, A>, B, C, D, E, F, G>; | ||
}; | ||
export declare type Without8<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, G extends Keys6<T, A, B, C, D, E, F>, H extends Keys7<T, A, B, C, D, E, F, G>> = Without<T, A> & { | ||
export type Without8<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, G extends Keys6<T, A, B, C, D, E, F>, H extends Keys7<T, A, B, C, D, E, F, G>> = Without<T, A> & { | ||
[id in A]: Without7<Val1<T, A>, B, C, D, E, F, G, H>; | ||
@@ -102,3 +107,3 @@ }; | ||
*/ | ||
declare type WithoutNReducer<T, C, R extends unknown[]> = C extends keyof T ? { | ||
type WithoutNReducer<T, C, R extends unknown[]> = C extends keyof T ? { | ||
0: Without<T, C>; | ||
@@ -110,28 +115,28 @@ 1: Without<T, C> & Record<C, WithoutNReducer<T[C], Head<R>, Tail<R>>>; | ||
*/ | ||
export declare type WithoutN<T, P extends unknown[]> = WithoutNReducer<T, Head<P>, Tail<P>>; | ||
export type WithoutN<T, P extends unknown[]> = WithoutNReducer<T, Head<P>, Tail<P>>; | ||
/** | ||
* Utilities for replacing types of nested keys. | ||
*/ | ||
export declare type Replace<T, A extends Keys<T>, V> = Without<T, A> & { | ||
export type Replace<T, A extends Keys<T>, V> = Without<T, A> & { | ||
[id in A]: V; | ||
}; | ||
export declare type Replace2<T, A extends Keys<T>, B extends Keys1<T, A>, V> = Without<T, A> & { | ||
export type Replace2<T, A extends Keys<T>, B extends Keys1<T, A>, V> = Without<T, A> & { | ||
[id in A]: Replace<Val1<T, A>, B, V>; | ||
}; | ||
export declare type Replace3<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, V> = Without<T, A> & { | ||
export type Replace3<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, V> = Without<T, A> & { | ||
[id in A]: Replace2<Val1<T, A>, B, C, V>; | ||
}; | ||
export declare type Replace4<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, V> = Without<T, A> & { | ||
export type Replace4<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, V> = Without<T, A> & { | ||
[id in A]: Replace3<Val1<T, A>, B, C, D, V>; | ||
}; | ||
export declare type Replace5<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, V> = Without<T, A> & { | ||
export type Replace5<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, V> = Without<T, A> & { | ||
[id in A]: Replace4<Val1<T, A>, B, C, D, E, V>; | ||
}; | ||
export declare type Replace6<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, V> = Without<T, A> & { | ||
export type Replace6<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, V> = Without<T, A> & { | ||
[id in A]: Replace5<Val1<T, A>, B, C, D, E, F, V>; | ||
}; | ||
export declare type Replace7<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, G extends Keys6<T, A, B, C, D, E, F>, V> = Without<T, A> & { | ||
export type Replace7<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, G extends Keys6<T, A, B, C, D, E, F>, V> = Without<T, A> & { | ||
[id in A]: Replace6<Val1<T, A>, B, C, D, E, F, G, V>; | ||
}; | ||
export declare type Replace8<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, G extends Keys6<T, A, B, C, D, E, F>, H extends Keys7<T, A, B, C, D, E, F, G>, V> = Without<T, A> & { | ||
export type Replace8<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, G extends Keys6<T, A, B, C, D, E, F>, H extends Keys7<T, A, B, C, D, E, F, G>, V> = Without<T, A> & { | ||
[id in A]: Replace7<Val1<T, A>, B, C, D, E, F, G, H, V>; | ||
@@ -149,3 +154,3 @@ }; | ||
*/ | ||
declare type ReplaceNReducer<T, C, R extends unknown[], V> = C extends keyof T ? { | ||
type ReplaceNReducer<T, C, R extends unknown[], V> = C extends keyof T ? { | ||
0: Replace<T, C, V>; | ||
@@ -157,4 +162,4 @@ 1: Without<T, C> & Record<C, ReplaceNReducer<T[C], Head<R>, Tail<R>, V>>; | ||
*/ | ||
export declare type ReplaceN<T, P extends unknown[], V> = ReplaceNReducer<T, Head<P>, Tail<P>, V>; | ||
export type ReplaceN<T, P extends unknown[], V> = ReplaceNReducer<T, Head<P>, Tail<P>, V>; | ||
export {}; | ||
//# sourceMappingURL=keyval.d.ts.map |
@@ -1,6 +0,6 @@ | ||
export declare type Nullable<T> = T | null | undefined; | ||
export type Nullable<T> = T | null | undefined; | ||
/** | ||
* Similar to `NonNullable`, but only excludes `undefined`. | ||
*/ | ||
export declare type Always<T> = T extends undefined ? never : T; | ||
export type Always<T> = T extends undefined ? never : T; | ||
//# sourceMappingURL=null.d.ts.map |
{ | ||
"name": "@thi.ng/api", | ||
"version": "8.5.1", | ||
"version": "8.6.0", | ||
"description": "Common, generic types, interfaces & mixins", | ||
@@ -24,3 +24,6 @@ "type": "module", | ||
], | ||
"author": "Karsten Schmidt <k+npm@thi.ng>", | ||
"author": "Karsten Schmidt (https://thi.ng)", | ||
"contributors": [ | ||
"Matei Adriel (https://github.com/Mateiadrielrafael)" | ||
], | ||
"license": "Apache-2.0", | ||
@@ -38,8 +41,8 @@ "scripts": { | ||
"devDependencies": { | ||
"@microsoft/api-extractor": "^7.33.5", | ||
"@thi.ng/testament": "^0.3.6", | ||
"@microsoft/api-extractor": "^7.33.7", | ||
"@thi.ng/testament": "^0.3.7", | ||
"rimraf": "^3.0.2", | ||
"tools": "^0.0.1", | ||
"typedoc": "^0.23.20", | ||
"typescript": "^4.8.4" | ||
"typedoc": "^0.23.22", | ||
"typescript": "^4.9.4" | ||
}, | ||
@@ -227,3 +230,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "1fe40da507070653f420156d91e6b27cf682004f\n" | ||
"gitHead": "f445a9cc8022bcdebbf6ff91fd66ced016d72f01\n" | ||
} |
@@ -7,39 +7,39 @@ import type { NumOrString } from "./prim.js"; | ||
*/ | ||
export declare type Path = readonly NumOrString[] | NumOrString; | ||
export type Path = readonly NumOrString[] | NumOrString; | ||
/** | ||
* Empty lookup path. | ||
*/ | ||
export declare type Path0 = readonly []; | ||
export type Path0 = readonly []; | ||
/** | ||
* Type checked lookup path (depth 1) | ||
*/ | ||
export declare type Path1<T, A> = A extends Keys<T> ? readonly [A] : never; | ||
export type Path1<T, A> = A extends Keys<T> ? readonly [A] : never; | ||
/** | ||
* Type checked lookup path (depth 2) | ||
*/ | ||
export declare type Path2<T, A, B> = A extends Keys<T> ? B extends Keys1<T, A> ? readonly [A, B] : never : never; | ||
export type Path2<T, A, B> = A extends Keys<T> ? B extends Keys1<T, A> ? readonly [A, B] : never : never; | ||
/** | ||
* Type checked lookup path (depth 3) | ||
*/ | ||
export declare type Path3<T, A, B, C> = A extends Keys<T> ? B extends Keys1<T, A> ? C extends Keys2<T, A, B> ? readonly [A, B, C] : never : never : never; | ||
export type Path3<T, A, B, C> = A extends Keys<T> ? B extends Keys1<T, A> ? C extends Keys2<T, A, B> ? readonly [A, B, C] : never : never : never; | ||
/** | ||
* Type checked lookup path (depth 4) | ||
*/ | ||
export declare type Path4<T, A, B, C, D> = A extends Keys<T> ? B extends Keys1<T, A> ? C extends Keys2<T, A, B> ? D extends Keys3<T, A, B, C> ? readonly [A, B, C, D] : never : never : never : never; | ||
export type Path4<T, A, B, C, D> = A extends Keys<T> ? B extends Keys1<T, A> ? C extends Keys2<T, A, B> ? D extends Keys3<T, A, B, C> ? readonly [A, B, C, D] : never : never : never : never; | ||
/** | ||
* Type checked lookup path (depth 5) | ||
*/ | ||
export declare type Path5<T, A, B, C, D, E> = A extends Keys<T> ? B extends Keys1<T, A> ? C extends Keys2<T, A, B> ? D extends Keys3<T, A, B, C> ? E extends Keys4<T, A, B, C, D> ? readonly [A, B, C, D, E] : never : never : never : never : never; | ||
export type Path5<T, A, B, C, D, E> = A extends Keys<T> ? B extends Keys1<T, A> ? C extends Keys2<T, A, B> ? D extends Keys3<T, A, B, C> ? E extends Keys4<T, A, B, C, D> ? readonly [A, B, C, D, E] : never : never : never : never : never; | ||
/** | ||
* Type checked lookup path (depth 6) | ||
*/ | ||
export declare type Path6<T, A, B, C, D, E, F> = A extends Keys<T> ? B extends Keys1<T, A> ? C extends Keys2<T, A, B> ? D extends Keys3<T, A, B, C> ? E extends Keys4<T, A, B, C, D> ? F extends Keys5<T, A, B, C, D, E> ? readonly [A, B, C, D, E, F] : never : never : never : never : never : never; | ||
export type Path6<T, A, B, C, D, E, F> = A extends Keys<T> ? B extends Keys1<T, A> ? C extends Keys2<T, A, B> ? D extends Keys3<T, A, B, C> ? E extends Keys4<T, A, B, C, D> ? F extends Keys5<T, A, B, C, D, E> ? readonly [A, B, C, D, E, F] : never : never : never : never : never : never; | ||
/** | ||
* Type checked lookup path (depth 7) | ||
*/ | ||
export declare type Path7<T, A, B, C, D, E, F, G> = A extends Keys<T> ? B extends Keys1<T, A> ? C extends Keys2<T, A, B> ? D extends Keys3<T, A, B, C> ? E extends Keys4<T, A, B, C, D> ? F extends Keys5<T, A, B, C, D, E> ? G extends Keys6<T, A, B, C, D, E, F> ? readonly [A, B, C, D, E, F, G] : never : never : never : never : never : never : never; | ||
export type Path7<T, A, B, C, D, E, F, G> = A extends Keys<T> ? B extends Keys1<T, A> ? C extends Keys2<T, A, B> ? D extends Keys3<T, A, B, C> ? E extends Keys4<T, A, B, C, D> ? F extends Keys5<T, A, B, C, D, E> ? G extends Keys6<T, A, B, C, D, E, F> ? readonly [A, B, C, D, E, F, G] : never : never : never : never : never : never : never; | ||
/** | ||
* Type checked lookup path (depth 8) | ||
*/ | ||
export declare type Path8<T, A, B, C, D, E, F, G, H> = A extends Keys<T> ? B extends Keys1<T, A> ? C extends Keys2<T, A, B> ? D extends Keys3<T, A, B, C> ? E extends Keys4<T, A, B, C, D> ? F extends Keys5<T, A, B, C, D, E> ? G extends Keys6<T, A, B, C, D, E, F> ? H extends Keys7<T, A, B, C, D, E, F, G> ? readonly [A, B, C, D, E, F, G, H] : never : never : never : never : never : never : never : never; | ||
export type Path8<T, A, B, C, D, E, F, G, H> = A extends Keys<T> ? B extends Keys1<T, A> ? C extends Keys2<T, A, B> ? D extends Keys3<T, A, B, C> ? E extends Keys4<T, A, B, C, D> ? F extends Keys5<T, A, B, C, D, E> ? G extends Keys6<T, A, B, C, D, E, F> ? H extends Keys7<T, A, B, C, D, E, F, G> ? readonly [A, B, C, D, E, F, G, H] : never : never : never : never : never : never : never : never; | ||
/** | ||
@@ -49,15 +49,15 @@ * Semi-typechecked lookup path (depth > 8). Only the first 8 levels are | ||
*/ | ||
export declare type DeepPath<T, A, B, C, D, E, F, G, H> = A extends Keys<T> ? B extends Keys1<T, A> ? C extends Keys2<T, A, B> ? D extends Keys3<T, A, B, C> ? E extends Keys4<T, A, B, C, D> ? F extends Keys5<T, A, B, C, D, E> ? G extends Keys6<T, A, B, C, D, E, F> ? H extends Keys7<T, A, B, C, D, E, F, G> ? readonly [A, B, C, D, E, F, G, H, ...NumOrString[]] : never : never : never : never : never : never : never : never; | ||
export type DeepPath<T, A, B, C, D, E, F, G, H> = A extends Keys<T> ? B extends Keys1<T, A> ? C extends Keys2<T, A, B> ? D extends Keys3<T, A, B, C> ? E extends Keys4<T, A, B, C, D> ? F extends Keys5<T, A, B, C, D, E> ? G extends Keys6<T, A, B, C, D, E, F> ? H extends Keys7<T, A, B, C, D, E, F, G> ? readonly [A, B, C, D, E, F, G, H, ...NumOrString[]] : never : never : never : never : never : never : never : never; | ||
/** | ||
* Returns `RES` if `PRED` is `never`, else `RES | undefined` | ||
*/ | ||
export declare type OptVal<PRED, RES> = [PRED] extends [never] ? RES : RES | undefined; | ||
export type OptVal<PRED, RES> = [PRED] extends [never] ? RES : RES | undefined; | ||
/** | ||
* Returns true if `T` includes undefined. | ||
*/ | ||
export declare type IsOpt<T> = T extends undefined ? true : never; | ||
export type IsOpt<T> = T extends undefined ? true : never; | ||
/** | ||
* Internal recursive helper type for {@link IsOptPath}. | ||
*/ | ||
declare type IsOptR<T, K, P extends unknown[]> = K extends Keys<T> ? [true] extends [IsOpt<T[K]>] ? true : { | ||
type IsOptR<T, K, P extends unknown[]> = K extends Keys<T> ? [true] extends [IsOpt<T[K]>] ? true : { | ||
0: IsOptR<Required<T>[K], Head<P>, Tail<P>>; | ||
@@ -73,3 +73,3 @@ 1: never; | ||
*/ | ||
export declare type IsOptPath<T, P extends unknown[]> = P extends [] ? never : IsOptR<T, Head<P>, Tail<P>>; | ||
export type IsOptPath<T, P extends unknown[]> = P extends [] ? never : IsOptR<T, Head<P>, Tail<P>>; | ||
/** | ||
@@ -83,3 +83,3 @@ * Similar to {@link PathVal}, but also takes into account if given path | ||
*/ | ||
export declare type OptPathVal<T, P extends unknown[]> = OptVal<IsOptPath<T, P>, ValN<T, P>>; | ||
export type OptPathVal<T, P extends unknown[]> = OptVal<IsOptPath<T, P>, ValN<T, P>>; | ||
/** | ||
@@ -89,4 +89,4 @@ * Returns nested value type for given path into `T` or `never` if path | ||
*/ | ||
export declare type PathVal<T, P extends unknown[]> = ValN<T, P>; | ||
export type PathVal<T, P extends unknown[]> = ValN<T, P>; | ||
export {}; | ||
//# sourceMappingURL=path.d.ts.map |
@@ -5,15 +5,15 @@ import type { Fn, Fn0, Fn2 } from "./fn.js"; | ||
*/ | ||
export declare type Predicate<T> = Fn<T, boolean>; | ||
export type Predicate<T> = Fn<T, boolean>; | ||
/** | ||
* Predicate function mapping given args to true/false. | ||
*/ | ||
export declare type Predicate2<T> = Fn2<T, T, boolean>; | ||
export type Predicate2<T> = Fn2<T, T, boolean>; | ||
/** | ||
* Higher order {@link Predicate} builder. Possibly stateful. | ||
*/ | ||
export declare type StatefulPredicate<T> = Fn0<Predicate<T>>; | ||
export type StatefulPredicate<T> = Fn0<Predicate<T>>; | ||
/** | ||
* Higher order {@link Predicate2} builder. Possibly stateful. | ||
*/ | ||
export declare type StatefulPredicate2<T> = Fn0<Predicate2<T>>; | ||
export type StatefulPredicate2<T> = Fn0<Predicate2<T>>; | ||
//# sourceMappingURL=predicate.d.ts.map |
@@ -1,4 +0,4 @@ | ||
export declare type NumOrString = number | string; | ||
export declare type StringOrSym = string | symbol; | ||
export declare type Primitive = NumOrString | boolean | symbol; | ||
export type NumOrString = number | string; | ||
export type StringOrSym = string | symbol; | ||
export type Primitive = NumOrString | boolean | symbol; | ||
//# sourceMappingURL=prim.d.ts.map |
@@ -1,25 +0,25 @@ | ||
export declare type Range = [number, number]; | ||
export declare type Range0_1 = 0 | 1; | ||
export declare type Range0_3 = Range0_1 | 2 | 3; | ||
export declare type Range0_7 = Range0_3 | Range4_7; | ||
export declare type Range0_15 = Range0_7 | Range8_15; | ||
export declare type Range0_23 = Range0_15 | Range16_23; | ||
export declare type Range0_31 = Range0_15 | Range16_31; | ||
export declare type Range0_47 = Range0_31 | Range32_47; | ||
export declare type Range0_63 = Range0_31 | Range32_63; | ||
export declare type Range1_2 = 1 | 2; | ||
export declare type Range1_4 = Range1_2 | 3 | 4; | ||
export declare type Range1_8 = Range1_4 | Range4_7 | 8; | ||
export declare type Range1_16 = Range1_8 | Range8_15 | 16; | ||
export declare type Range1_24 = Range1_16 | Range16_23 | 24; | ||
export declare type Range1_32 = Range1_16 | Range16_31 | 32; | ||
export declare type Range1_48 = Range1_32 | Range32_47 | 48; | ||
export declare type Range1_64 = Range1_32 | Range32_63 | 64; | ||
export declare type Range4_7 = 4 | 5 | 6 | 7; | ||
export declare type Range8_15 = 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15; | ||
export declare type Range16_23 = 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23; | ||
export declare type Range16_31 = Range16_23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31; | ||
export declare type Range32_47 = 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47; | ||
export declare type Range48_63 = 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63; | ||
export declare type Range32_63 = Range32_47 | Range48_63; | ||
export type Range = [number, number]; | ||
export type Range0_1 = 0 | 1; | ||
export type Range0_3 = Range0_1 | 2 | 3; | ||
export type Range0_7 = Range0_3 | Range4_7; | ||
export type Range0_15 = Range0_7 | Range8_15; | ||
export type Range0_23 = Range0_15 | Range16_23; | ||
export type Range0_31 = Range0_15 | Range16_31; | ||
export type Range0_47 = Range0_31 | Range32_47; | ||
export type Range0_63 = Range0_31 | Range32_63; | ||
export type Range1_2 = 1 | 2; | ||
export type Range1_4 = Range1_2 | 3 | 4; | ||
export type Range1_8 = Range1_4 | Range4_7 | 8; | ||
export type Range1_16 = Range1_8 | Range8_15 | 16; | ||
export type Range1_24 = Range1_16 | Range16_23 | 24; | ||
export type Range1_32 = Range1_16 | Range16_31 | 32; | ||
export type Range1_48 = Range1_32 | Range32_47 | 48; | ||
export type Range1_64 = Range1_32 | Range32_63 | 64; | ||
export type Range4_7 = 4 | 5 | 6 | 7; | ||
export type Range8_15 = 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15; | ||
export type Range16_23 = 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23; | ||
export type Range16_31 = Range16_23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31; | ||
export type Range32_47 = 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47; | ||
export type Range48_63 = 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63; | ||
export type Range32_63 = Range32_47 | Range48_63; | ||
/** | ||
@@ -26,0 +26,0 @@ * Type LUT of allowed range values `[0..n)` for given range size `n`. |
<!-- This file is generated - DO NOT EDIT! --> | ||
# ![api](https://media.thi.ng/umbrella/banners-20220914/thing-api.svg?1c0ba288) | ||
# ![@thi.ng/api](https://media.thi.ng/umbrella/banners-20220914/thing-api.svg?1c0ba288) | ||
[![npm version](https://img.shields.io/npm/v/@thi.ng/api.svg)](https://www.npmjs.com/package/@thi.ng/api) | ||
![npm downloads](https://img.shields.io/npm/dm/@thi.ng/api.svg) | ||
[![Twitter Follow](https://img.shields.io/twitter/follow/thing_umbrella.svg?style=flat-square&label=twitter)](https://twitter.com/thing_umbrella) | ||
[![Mastodon Follow](https://img.shields.io/mastodon/follow/109331703950160316?domain=https%3A%2F%2Fmastodon.thi.ng&style=social)](https://mastodon.thi.ng/@toxi) | ||
@@ -18,4 +18,2 @@ This project is part of the | ||
- [Authors](#authors) | ||
- [Maintainer](#maintainer) | ||
- [Contributors](#contributors) | ||
- [License](#license) | ||
@@ -25,3 +23,3 @@ | ||
Common, generic types, interfaces & mixins. | ||
Common, generic types, interfaces & mixins | ||
@@ -58,7 +56,4 @@ This package is implicitly used by most other projects in this repository. It | ||
```text | ||
# with flag only for < v16 | ||
node --experimental-repl-await | ||
> const api = await import("@thi.ng/api"); | ||
```js | ||
const api = await import("@thi.ng/api"); | ||
``` | ||
@@ -78,10 +73,5 @@ | ||
### Maintainer | ||
- [Karsten Schmidt](https://thi.ng) (Main author) | ||
- [Matei Adriel](https://github.com/Mateiadrielrafael) | ||
- Karsten Schmidt ([@postspectacular](https://github.com/postspectacular)) | ||
### Contributors | ||
- Matei Adriel ([@Mateiadrielrafael](https://github.com/Mateiadrielrafael)) | ||
If this project contributes to an academic publication, please cite it as: | ||
@@ -100,2 +90,2 @@ | ||
© 2016 - 2022 Karsten Schmidt // Apache Software License 2.0 | ||
© 2016 - 2022 Karsten Schmidt // Apache License 2.0 |
@@ -1,4 +0,4 @@ | ||
export declare type Select2<T, Q, A, B> = T extends Q ? A : B; | ||
export declare type Select3<T, Q1, Q2, A, B, C> = T extends Q1 ? A : T extends Q2 ? B : C; | ||
export declare type Select4<T, Q1, Q2, Q3, A, B, C, D> = T extends Q1 ? A : T extends Q2 ? B : T extends Q3 ? C : D; | ||
export type Select2<T, Q, A, B> = T extends Q ? A : B; | ||
export type Select3<T, Q1, Q2, A, B, C> = T extends Q1 ? A : T extends Q2 ? B : C; | ||
export type Select4<T, Q1, Q2, Q3, A, B, C, D> = T extends Q1 ? A : T extends Q2 ? B : T extends Q3 ? C : D; | ||
//# sourceMappingURL=select.d.ts.map |
@@ -6,3 +6,3 @@ import type { TypedArray } from "./typedarray.js"; | ||
*/ | ||
export declare type ArrayValue<T extends unknown[]> = T[0]; | ||
export type ArrayValue<T extends unknown[]> = T[0]; | ||
/** | ||
@@ -14,3 +14,3 @@ * Somewhat similar, but recursive version of {@link ArrayValue}. If `T` is an | ||
*/ | ||
export declare type DeepArrayValue<T> = T extends unknown[] ? DeepArrayValue<T[0]> : T extends TypedArray ? number : T; | ||
export type DeepArrayValue<T> = T extends unknown[] ? DeepArrayValue<T[0]> : T extends TypedArray ? number : T; | ||
/** | ||
@@ -20,3 +20,3 @@ * Defines a fixed sized, iterable tuple with elements of type `T` and | ||
*/ | ||
export declare type Tuple<T, N extends number> = [T, ...T[]] & { | ||
export type Tuple<T, N extends number> = [T, ...T[]] & { | ||
length: N; | ||
@@ -27,19 +27,19 @@ } & Iterable<T>; | ||
*/ | ||
export declare type TupleLength<T extends unknown[]> = T["length"]; | ||
export type TupleLength<T extends unknown[]> = T["length"]; | ||
/** | ||
* Returns 1 if T is empty tuple, else 0 | ||
*/ | ||
export declare type IsEmpty<T extends unknown[]> = T extends [] ? 1 : 0; | ||
export type IsEmpty<T extends unknown[]> = T extends [] ? 1 : 0; | ||
/** | ||
* Extracts the first element of a tuple. | ||
*/ | ||
export declare type Head<T extends unknown[]> = T extends [infer A, ...unknown[]] ? A : never; | ||
export type Head<T extends unknown[]> = T extends [infer A, ...unknown[]] ? A : never; | ||
/** | ||
* Extracts everything except the first element from a tuple. | ||
*/ | ||
export declare type Tail<T extends unknown[]> = T extends [unknown, ...infer A] ? A : never; | ||
export type Tail<T extends unknown[]> = T extends [unknown, ...infer A] ? A : never; | ||
/** | ||
* Adds an element at the start of an tuple. | ||
*/ | ||
export declare type Prepend<T, U extends unknown[]> = [T, ...U]; | ||
export type Prepend<T, U extends unknown[]> = [T, ...U]; | ||
/** | ||
@@ -49,3 +49,3 @@ * Internal version of {@link Reverse} accepting 1 extra argument for | ||
*/ | ||
declare type ReverseReducer<T extends unknown[], C extends unknown[]> = { | ||
type ReverseReducer<T extends unknown[], C extends unknown[]> = { | ||
0: C; | ||
@@ -58,7 +58,7 @@ 1: Prepend<Head<T>, C>; | ||
*/ | ||
export declare type Reverse<T extends unknown[]> = ReverseReducer<T, []>; | ||
export type Reverse<T extends unknown[]> = ReverseReducer<T, []>; | ||
/** | ||
* Extracts the last element from a tuple. | ||
*/ | ||
export declare type Last<T extends unknown[]> = { | ||
export type Last<T extends unknown[]> = { | ||
0: Last<Tail<T>>; | ||
@@ -70,3 +70,3 @@ 1: Head<T>; | ||
*/ | ||
export declare type ButLast<T extends unknown[], C extends unknown[] = []> = { | ||
export type ButLast<T extends unknown[], C extends unknown[] = []> = { | ||
0: ButLast<Tail<T>, Prepend<Head<T>, C>>; | ||
@@ -73,0 +73,0 @@ 1: Reverse<C>; |
@@ -1,13 +0,13 @@ | ||
export declare type ArrayLikeIterable<T> = ArrayLike<T> & Iterable<T>; | ||
export declare type NumericArray = number[] | TypedArray; | ||
export declare type TypedArray = Float32Array | Float64Array | Int8Array | Int16Array | Int32Array | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array; | ||
export declare type BigTypedArray = BigInt64Array | BigUint64Array; | ||
export declare type FloatArray = Float32Array | Float64Array; | ||
export declare type IntArray = Int8Array | Int16Array | Int32Array; | ||
export declare type UIntArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array; | ||
export declare type FloatArrayConstructor = Float32ArrayConstructor | Float64ArrayConstructor; | ||
export declare type IntArrayConstructor = Int8ArrayConstructor | Int16ArrayConstructor | Int32ArrayConstructor; | ||
export declare type UIntArrayConstructor = Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor; | ||
export declare type BigIntArrayConstructor = BigInt64ArrayConstructor | BigUint64ArrayConstructor; | ||
export declare type TypedArrayConstructor = FloatArrayConstructor | IntArrayConstructor | UIntArrayConstructor; | ||
export type ArrayLikeIterable<T> = ArrayLike<T> & Iterable<T>; | ||
export type NumericArray = number[] | TypedArray; | ||
export type TypedArray = Float32Array | Float64Array | Int8Array | Int16Array | Int32Array | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array; | ||
export type BigTypedArray = BigInt64Array | BigUint64Array; | ||
export type FloatArray = Float32Array | Float64Array; | ||
export type IntArray = Int8Array | Int16Array | Int32Array; | ||
export type UIntArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array; | ||
export type FloatArrayConstructor = Float32ArrayConstructor | Float64ArrayConstructor; | ||
export type IntArrayConstructor = Int8ArrayConstructor | Int16ArrayConstructor | Int32ArrayConstructor; | ||
export type UIntArrayConstructor = Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor; | ||
export type BigIntArrayConstructor = BigInt64ArrayConstructor | BigUint64ArrayConstructor; | ||
export type TypedArrayConstructor = FloatArrayConstructor | IntArrayConstructor | UIntArrayConstructor; | ||
/** | ||
@@ -19,7 +19,7 @@ * Type IDs for typed array backed buffers and generally describing binary data | ||
*/ | ||
export declare type Type = "u8" | "u8c" | "i8" | "u16" | "i16" | "u32" | "i32" | "f32" | "f64"; | ||
export declare type BigType = "i64" | "u64"; | ||
export declare type UintType = "u8" | "u8c" | "u16" | "u32"; | ||
export declare type IntType = "i8" | "i16" | "i32"; | ||
export declare type FloatType = "f32" | "f64"; | ||
export type Type = "u8" | "u8c" | "i8" | "u16" | "i16" | "u32" | "i32" | "f32" | "f64"; | ||
export type BigType = "i64" | "u64"; | ||
export type UintType = "u8" | "u8c" | "u16" | "u32"; | ||
export type IntType = "i8" | "i16" | "i32"; | ||
export type FloatType = "f32" | "f64"; | ||
/** | ||
@@ -26,0 +26,0 @@ * WebGL numeric type constants. Use {@link GL2TYPE} to convert, if needed. |
/** | ||
* Observer function for {@link IWatch} implementations. | ||
*/ | ||
export declare type Watch<T> = (id: string, oldState: T, newState: T) => void; | ||
export type Watch<T> = (id: string, oldState: T, newState: T) => void; | ||
/** | ||
@@ -6,0 +6,0 @@ * Interface for types offering observers of internal value changes. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2399
119911
87