Pedantic: deny mutable type generalization #39915
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
Search Terms
type generalization
type expanding
Suggestion
Currently we have a vulnerability in type safety of mutable variables. You can generalize the type of some variable and change its value by passing there something not compatible with the old type. Examples:
So I suggest adding a new compiler option under 'pedantic' label which will deny such type conversions:
The text was updated successfully, but these errors were encountered: