feat(typescript-types): Fully rewrite KeyPaths<T,O,F>

This commit is contained in:
T. R. Bernstein
2025-07-17 16:40:19 +02:00
parent 527250a98a
commit c3238a6847
3 changed files with 30 additions and 26 deletions

View File

@@ -46,13 +46,13 @@ The types included in this library are categorized by their purpose.
| Type | Description |
| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`KeyPaths<T, F, O>`][] | A union of all keypaths of `T` where the value does not extend `F`. Separator can be set via `O['separator']`. |
| [`KeyPaths<T, O, F>`][] | A union of all keypaths of `T` where the value does not extend `F`. Separator can be set via `O['separator']`. |
| [`OptionalKeysOf<T>`][] | A union of all keys of `T` that are marked as optional. If `T` is a union, a union of the optional keys of all union members of `T` is returned[^optional-keys-of_remark]. |
| [`PickAssignable<T, K>`][] | Return a mapped type with all keys of `T` that extend `K`. If no key does extend `K` an empty type is returned. |
[^optional-keys-of_remark]: If `T` is `any`, it returns a union of string and number 'string | number'.
[`KeyPaths<T, F, O>`]: src/key-paths.ts
[`KeyPaths<T, O, F>`]: src/key-paths.ts
[`OptionalKeysOf<T>`]: src/optional-keys-of.ts
[`PickAssignable<T, K>`]: src/pick-assignable.ts