Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/phryneas/ts-deep-extract-types
https://github.com/phryneas/ts-deep-extract-types
library
Last synced: 11 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/phryneas/ts-deep-extract-types
- Owner: phryneas
- Created: 2020-03-11T10:45:13.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-05-11T13:52:09.000Z (over 3 years ago)
- Last Synced: 2024-10-03T12:28:51.640Z (about 1 month ago)
- Topics: library
- Language: TypeScript
- Homepage:
- Size: 449 KB
- Stars: 41
- Watchers: 4
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-list - ts-deep-extract-types
README
This packages exposes types that allow you to extract deeply nested types.
# `type DeepExtractTypeSkipArrays`
Extracts a deeply-nested type from the target `Path` in `Source`, skipping arrays and ignoring null|undefined|optional types:
```ts
type QueryResult = { allPosts?: Array<{ users?: Array<{ name: string }> }> };
// will be { name: string }
type User = DeepExtractTypeSkipArrays;
```# `type DeepExtractType`
Extracts a deeply-nested type from the target `Path` in `Source`, ignoring null|undefined|optional types:
```ts
type QueryResult = { user?: { firstPost?: { title: string } } };
// will be { title: string }
type Post = DeepExtractType;
```