-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
Needs More InfoThe issue still hasn't been fully clarifiedThe issue still hasn't been fully clarifiedSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
This a meta-bug for tracking a set of things that we could address with a compiler flag that tightens certain aspects of TypeScript that users generally perceive as too loose.
Will add to this list as appropriate
- Function return value constraints #228: Enforce expressions in
return
statements in type-annotated functions - Overload on constants: type checking additional parameters #191: Don't allow mismatched constant string overloads to be selected due to other parameters
- Suggestion: disallow use before definition #21: Disallow use before definition (for types? for everything?)
Issue a warning when generic type inference produces {} #360: Error when generic type inference produces ex nihilo- now a default{}
Contentious issues that have been mentioned:
Done!
- Allow stricter structural typing #391: Detecting accidental surplus properties
Not happening:
Inherited types in callback functions #222: Function argument bivariance- We would want some strong motivating examples here; this behavior is desired in a lot of scenarios and is less "surprising" than others.
- This isn't a plausible design path. See comments here allow a flag that turns off covariant parameters when checking function assignability #6102 (comment)
Note: This is not a "fork the language" flag. The type system itself would be unchanged under this flag; it would simply change some operations from being allowed to being errors. For example, we would not change the order of overload resolution, or change the type of null
, because that would have non-local effects and everyone would have to agree on whether or not the flag was on.
michaelmesser, svieira and tp
Metadata
Metadata
Assignees
Labels
Needs More InfoThe issue still hasn't been fully clarifiedThe issue still hasn't been fully clarifiedSuggestionAn idea for TypeScriptAn idea for TypeScript