sindresorhus / type-fest

A collection of essential TypeScript types
Creative Commons Zero v1.0 Universal
14k stars 531 forks source link

Proposal: `ValueOfDeep<Type, 'key.deepKey'>` #822

Open joaomarcelofm opened 6 months ago

joaomarcelofm commented 6 months ago

Short summary

Given: Type: Any type

Provide: Create a type based on the ValueOf of a deeply nested property.

Potential definition

type ValueOfDeep<Type, PathUnion extends Paths<T>>

Use case

Selecting deeply nested objects to be the value of a new type. This may be relevant for auto-generated types where the deep objects aren't unique types but are used independently on the application.

Upvote & Fund

Fund with Polar

sindresorhus commented 6 months ago

Accepted

https://github.com/sindresorhus/type-fest/blob/main/.github/contributing.md#submitting-a-new-type