feat(typescript-types): Fully rewrite KeyPaths<T,O,F>
Rewrite KeyPaths to eleminate 'Too deep instantiations' error of TypeScript.
This commit is contained in:
@@ -18,10 +18,26 @@ The types included in this library are categorized by their purpose.
|
||||
[`BuiltIns`]: src/built-ins.ts
|
||||
[`NonContainerType`]: src/non-container-type.ts
|
||||
|
||||
#### Boolean Operator Types
|
||||
|
||||
| Type | Description |
|
||||
| --------------- | -------------------------------------------------------------------------- |
|
||||
| [`And<A, B>`][] | `true` if `A` and `B` (both extend `boolean`) are both `true`. |
|
||||
| [`Not<A>`][] | `true` if `A` (extends `boolean`) is `false` and vice-versa. |
|
||||
| [`Or<A>`][] | `true` if either `A` or `B` (both extend `boolean`) is `true`. |
|
||||
| [`Xor<A, B>`][] | `true` if `A` and `B` (both extend `boolean`) are not both `false`/`true`. |
|
||||
|
||||
[`And<A, B>`]: src/and.ts
|
||||
[`Not<A>`]: src/not.ts
|
||||
[`Or<A>`]: src/or.ts
|
||||
[`Xor<A, B>`]: src/xor.ts
|
||||
|
||||
#### Test Types
|
||||
|
||||
| Type | Description |
|
||||
| --------------------------------------- | --------------------------------------------------------------------------------------------------------- |
|
||||
| [`Extends<A, B>`][] | `true` if `A` extends `B`, `false` otherwise[^extends_remark]. |
|
||||
| [`ExtendsExactly<A, B>`][] | `true` if `A` extends `B`, `false` otherwise[^extends-exactly_remark]. |
|
||||
| [`IsAny<T>`][] | `true` if `T` is `any`, `false` otherwise (`null`, `undefined` also yield `false`) |
|
||||
| [`IsNever<T>`][] | `true` if `T` is `never`, `false` otherwise (`null`, `undefined`, `any` also yield `false`) |
|
||||
| [`IsUndefined<T>`][] | `true` if `T` is `undefined`, `false` otherwise (`null`, `never`, `any` also yield `false`). |
|
||||
@@ -30,10 +46,12 @@ The types included in this library are categorized by their purpose.
|
||||
| [`IsKeyOf<T, K>`][] | `true` if `K` is a key of `T`, `false` otherwise. If `T` is `any`, any `K` but `never` will yield `true`. |
|
||||
| [`IsEmptyString<S>`][] | `true` if `S` is the empty string `''`, `false` otherwise.[^is-empty-string_remark] |
|
||||
|
||||
[^if_remark]: If `boolean` is passed as `Test` the return value is a union of both branches, i.e. `TrueBranch | FalseBranch`.
|
||||
[^extends_remark]: The result may be `boolean` (aka `true | false`) if `A` or `B` is a union type and the union members evaluate to different boolean results.
|
||||
|
||||
[^is-empty-string_remark]: If `T` is `any` will yield `true`, as it is taken to be `any` string.
|
||||
[^extends-exactly_remark]: The extends check is done non-distributively in case `A` or `B` is a union type.
|
||||
|
||||
[`Extends<A, B>`]: src/extends.ts
|
||||
[`ExtendsExactly<A, B>`]: src/extends-exactly.ts
|
||||
[`IsAny<T>`]: src/is-any.ts
|
||||
[`IsNever<T>`]: src/is-never.ts
|
||||
[`IsUndefined<T>`]: src/is-undefined.ts
|
||||
@@ -70,8 +88,10 @@ The types included in this library are categorized by their purpose.
|
||||
|
||||
#### Combination Types
|
||||
|
||||
| Type | Description |
|
||||
| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
|
||||
| [`Assign<Shape, Defaults, Obj>`][] | Return a type with the structure of `Shape` and value types from `Obj` or `Default` for missing optional keys in `Obj`. |
|
||||
| Type | Description |
|
||||
| --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
|
||||
| [`Assign<Shape, Defaults, Obj>`][] | Return a type with the structure of `Shape` and value types from `Obj` or `Default` for missing optional keys in `Obj`. |
|
||||
| [`Concat<Prefix, Suffix, Separator>`][] | Concatenate `Prefix` and `Suffix` and - if both are non empty strings - separate them using `Separator`. |
|
||||
|
||||
[`Assign<Shape, Defaults, Obj>`]: src/assign.ts
|
||||
[`Concat<Prefix, Suffix, Separator>`]: src/concat.ts
|
||||
|
||||
Reference in New Issue
Block a user