Closed
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.