The field of a generic is omitted for the function parameter but should be addible #42959
Open
5 tasks done
Labels
Needs More Info
The issue still hasn't been fully clarified
Suggestion
π Search Terms
Generics
Narrow Extension
β Viability Checklist
My suggestion meets these guidelines:
This wouldn't be a breaking change in existing TypeScript/JavaScript code
This wouldn't change the runtime behavior of existing JavaScript code
This could be implemented without emitting different JS based on the types of the expressions
This feature would agree with the rest of TypeScript's Design Goals.
This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
β Suggestion
It would be really nice if you can extend an object with one/selection of keys, in which the types of that keys don't get extended.
The problem with this extension is, that it doesn't allow for a pipe, where you omit some part of it, as it gets added in that pipe with the correct type (e.g. string), but as the generic could be an extension of string you can no longer put it back together.
Maybe there is a workaround for this, but I couldn't find anything online
π Motivating Example
π» Use Cases
This would allow for some really nice currying and pipes, in which objects can be put together nicely with good levels of abstractions.
The text was updated successfully, but these errors were encountered: