Use-case for making weak-types / EPC more strict #51010
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
Suggestion
π Search Terms
exact types, epc, weak types, all optional properties
β Viability Checklist
My suggestion meets these guidelines:
β Suggestion
Consider the following problem...
Imo this should be solved by implementing exact types but given Ryan said in this...
... hence I'm filing this issue (not sure if it's a bug or a feature). Moreover there's also an involvement of a "weak type" here (namely the
Partial<Basket>
) so this part of that comment from Ryan also applies...Also note that this is a very common pattern in state-management libraries, that is take a function that returns a partial of the state to be updated. For example zustand implements this pattern and an user fell for this pitfall shown above and their typo compiled. I think we can agree that it'd be annoying if you debugged for a long time just to find a typo that the type-checker didn't catch.
This can be implemented in user-land though...
The text was updated successfully, but these errors were encountered: