-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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 issueGood First IssueWell scoped, documented and has the green lightWell scoped, documented and has the green lightHelp WantedYou can do thisYou can do thisSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
TypeScript Version: 4.1.0-dev
Search Terms:
operator in exception crash unhandled
Code
const hasKey = <A, K extends string | number | symbol>(
thing: A,
key: K,
): boolean => {
return key in thing;
};
hasKey(123, 'hello'); // TypeError exceptionExpected behavior:
TS should expect A to be an object
Actual behavior:
TS didn't detect the potential crash
Related Issues:
ExE-Boss
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 issueGood First IssueWell scoped, documented and has the green lightWell scoped, documented and has the green lightHelp WantedYou can do thisYou can do thisSuggestionAn idea for TypeScriptAn idea for TypeScript