satisfies
operator could not completely overshadow the existing contextual type
#57667
Open
6 tasks done
Labels
Needs Proposal
This issue needs a plan that clarifies the finer details of how it could be implemented.
Suggestion
An idea for TypeScript
๐ Search Terms
satisfies contextual type implicit any parameters
โ Viability Checklist
โญ Suggestion
It would be great if
satisfies
wouldn't completely disassociate the expression from the existing contextual type.๐ Motivating Example
๐ป Use Cases
It would be nice, at times, to add some extra constraints in places where the existing contextual type exists
satisfies
breaks existing contextual typing so things like contextual parameters "break". It requires us to type the parameters manually or to introduce identity functions with those extra constraints like belowThis is one of the possible workarounds:
However, this has an unintended side-effect: excess property check doesn't apply to this object now.
A similar shortcoming related to
ThisType
andsatisfies
combination has been recently reported here.The text was updated successfully, but these errors were encountered: