free-types-core 0.8.0 → 0.8.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/Licence +0 -0
- package/README.md +0 -0
- package/dist/Const.d.ts +0 -0
- package/dist/Const.js +0 -0
- package/dist/Remaining.d.ts +0 -0
- package/dist/Remaining.js +0 -0
- package/dist/Replace.d.ts +0 -0
- package/dist/Replace.js +0 -0
- package/dist/Type.d.ts +0 -0
- package/dist/Type.js +0 -0
- package/dist/TypesMap.d.ts +0 -0
- package/dist/TypesMap.js +0 -0
- package/dist/apply.d.ts +0 -0
- package/dist/apply.js +0 -0
- package/dist/free-types.d.ts +0 -0
- package/dist/free-types.js +0 -0
- package/dist/helpers.d.ts +0 -0
- package/dist/helpers.js +0 -0
- package/dist/hkt.d.ts +0 -0
- package/dist/hkt.js +0 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.js +0 -0
- package/dist/inferArgs.d.ts +0 -0
- package/dist/inferArgs.js +0 -0
- package/dist/partial.d.ts +0 -0
- package/dist/partial.js +0 -0
- package/dist/unwrap.d.ts +2 -2
- package/dist/unwrap.js +0 -0
- package/dist/utils.d.ts +4 -1
- package/dist/utils.js +0 -0
- package/package.json +1 -1
package/Licence
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
package/dist/Const.d.ts
CHANGED
|
File without changes
|
package/dist/Const.js
CHANGED
|
File without changes
|
package/dist/Remaining.d.ts
CHANGED
|
File without changes
|
package/dist/Remaining.js
CHANGED
|
File without changes
|
package/dist/Replace.d.ts
CHANGED
|
File without changes
|
package/dist/Replace.js
CHANGED
|
File without changes
|
package/dist/Type.d.ts
CHANGED
|
File without changes
|
package/dist/Type.js
CHANGED
|
File without changes
|
package/dist/TypesMap.d.ts
CHANGED
|
File without changes
|
package/dist/TypesMap.js
CHANGED
|
File without changes
|
package/dist/apply.d.ts
CHANGED
|
File without changes
|
package/dist/apply.js
CHANGED
|
File without changes
|
package/dist/free-types.d.ts
CHANGED
|
File without changes
|
package/dist/free-types.js
CHANGED
|
File without changes
|
package/dist/helpers.d.ts
CHANGED
|
File without changes
|
package/dist/helpers.js
CHANGED
|
File without changes
|
package/dist/hkt.d.ts
CHANGED
|
File without changes
|
package/dist/hkt.js
CHANGED
|
File without changes
|
package/dist/index.d.ts
CHANGED
|
File without changes
|
package/dist/index.js
CHANGED
|
File without changes
|
package/dist/inferArgs.d.ts
CHANGED
|
File without changes
|
package/dist/inferArgs.js
CHANGED
|
File without changes
|
package/dist/partial.d.ts
CHANGED
|
File without changes
|
package/dist/partial.js
CHANGED
|
File without changes
|
package/dist/unwrap.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrayKeys, Eq } from './utils';
|
|
1
|
+
import { ArrayKeys, Eq, And, Extends, Not } from './utils';
|
|
2
2
|
import { Type } from './Type';
|
|
3
3
|
import { inferArgs } from './inferArgs';
|
|
4
4
|
import { Generic, apply } from './apply';
|
|
@@ -22,7 +22,7 @@ declare global {
|
|
|
22
22
|
}
|
|
23
23
|
export { unwrap, Unwrapped, Search };
|
|
24
24
|
/** Decompose a type into its constituents */
|
|
25
|
-
declare type unwrap<T, From extends Search = TypesMap> = T
|
|
25
|
+
declare type unwrap<T, From extends Search = TypesMap> = And<Extends<T, readonly unknown[]>, Not<Extends<From, Type | Type[]>>> extends true ? unwrapLists<T extends readonly unknown[] ? T : never> : _unwrap<T, From extends Type ? [From] : From>;
|
|
26
26
|
declare type unwrapLists<T> = T extends unknown[] ? T extends [unknown, ...unknown[]] ? Unwrapped<'Tuple', Tuple, T> : Unwrapped<'Array', Array, [T[0]]> : T extends readonly [unknown, ...unknown[]] ? Unwrapped<'ReadonlyTuple', ReadonlyTuple, Mutable<T>> : Unwrapped<'ReadonlyArray', ReadonlyArray, [(T & unknown[])[0]]>;
|
|
27
27
|
declare type Mutable<T> = {
|
|
28
28
|
-readonly [K in keyof T]: K extends ArrayKeys ? T[K] : T[K];
|
package/dist/unwrap.js
CHANGED
|
File without changes
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Natural, Prev, Next, Subtract };
|
|
2
2
|
export { ArrayKeys, Slice, ToTuple, Tuple, Head, Tail, Last, Init };
|
|
3
|
-
export { Extends, Eq, IsUnknown, IsAny, IsOptional };
|
|
3
|
+
export { Extends, Eq, And, Not, IsUnknown, IsAny, IsOptional };
|
|
4
4
|
declare type Natural = [0, ..._Next];
|
|
5
5
|
declare type Prev<I extends number> = number extends I ? number : number & _Prev[I];
|
|
6
6
|
declare type _Prev = [never, ...Natural];
|
|
@@ -27,5 +27,8 @@ declare type IsUnknown<T> = unknown extends T ? IsAny<T> extends false ? true :
|
|
|
27
27
|
declare type IsAny<T> = Extends<T | anything, T & anything>;
|
|
28
28
|
declare type Extends<A, B> = [A] extends [B] ? true : false;
|
|
29
29
|
declare type Eq<A, B> = [A] extends [B] ? [B] extends [A] ? true : false : false;
|
|
30
|
+
declare type And<A, B> = Fork<A, Fork<B, B, false>, false>;
|
|
31
|
+
declare type Fork<P, T, F> = P extends false ? F : T;
|
|
32
|
+
declare type Not<T> = Extends<T, false>;
|
|
30
33
|
declare const thing: unique symbol;
|
|
31
34
|
declare type anything = typeof thing;
|
package/dist/utils.js
CHANGED
|
File without changes
|
package/package.json
CHANGED