-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueFixedA PR has been merged for this issueA PR has been merged 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
Originally reported in #14840
Consider WeakSet
for instance.. today it is defined as interface WeakSet <T> {...}
. This is incorrect, as it allows for patterns like const s = new WeakSet<string>(); s.add("foo");
which throws at runtime; the correct definition for WeakSet
is interface WeakSet<T extends object> { .. }
.
Changing this definition will cause errors in files that redefine WeakSet
to add additional members to it.
Error: All declarations of
WeakSet
must have identical type paramters
The proposal here is to allow type parameter declarations to skip constraints. conflicting constraints should still be reported as errors.
j-oliveras, SlurpTheo and thorn0
Metadata
Metadata
Assignees
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueFixedA PR has been merged for this issueA PR has been merged 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