Suggestion: Add an auto_init_properties
flag, emitting error if default value cannot be determined
#19750
Labels
Out of Scope
This idea sits outside of the TypeScript language design constraints
This is related to #8476. I'd suggest that, under some flags, instead of warning user of type safety caused by the default
undefined
value, give it a default value like C#, if the default value can't be determined, emit an error.In this way, all properties are actually defined in runtime:
Also, we don't need to write boilerplate code to enforce strict type safety:
The text was updated successfully, but these errors were encountered: