-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
Breaking ChangeWould introduce errors in existing codeWould introduce errors in existing codeCommittedThe team has roadmapped this issueThe team has roadmapped this issueFix AvailableA PR has been opened for this issueA PR has been opened for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
In TypeScript 4.0, we allowed users to to annotate catch variables with : unknown; however, it'd be nice if we could have that be the default.
I could imagine a flag like --useUnknownInCatchVariables to switch the default type to be unknown.
// @useUnknownInCatchVariables: true
try {
// ...
}
catch (e) {
e.toUpperCase(); // error
}Alternatively, I could also imagine a much broader flag that also types parameters as unknown as well.
MartinJohns, alexrock, milesj, treybrisbane, yortus and 42 morebrainkim, gerardolima, Nemikolh, worstpractice, voxpelli and 1 more
Metadata
Metadata
Assignees
Labels
Breaking ChangeWould introduce errors in existing codeWould introduce errors in existing codeCommittedThe team has roadmapped this issueThe team has roadmapped this issueFix AvailableA PR has been opened for this issueA PR has been opened for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript