TypeScript Version: 3.6.2
Search Terms:
noImplicitAny generic
Code
class Test<T> {
options: Map<T, string> = new Map()
constructor(options: Map<T, string>) {
}
}
let t = new Test(new Map())
t.options.set("a", "abc")
t.options.set(123, "abc")
Expected behavior:
When using strict / noImplicityAny I would expect that T which implicitly became any would be reported as an error.
Actual behavior:
No error thrown, T becomes of type any.
Playground Link:
https://www.typescriptlang.org/play/index.html?target=6#code/MYGwhgzhAEAqCmEAuAeWA+aBvAUNf0A9gA5ICWhAdhAFzQCyYxaANNMgE5mUDmmAvNErwA7gyYAKAJR4CwKpwCuwJIQ4SS5BXUbNYbTtz5TssggTPQAvjhs4Q8JNCeDhYhMglvxxaTKQAdJoU1AEQjhIARGCRbNEARsCR-kGkIRBhEQCMAEwAzHFgiclAA
TypeScript Version: 3.6.2
Search Terms:
noImplicitAny generic
Code
Expected behavior:
When using strict / noImplicityAny I would expect that T which implicitly became any would be reported as an error.
Actual behavior:
No error thrown, T becomes of type any.
Playground Link:
https://www.typescriptlang.org/play/index.html?target=6#code/MYGwhgzhAEAqCmEAuAeWA+aBvAUNf0A9gA5ICWhAdhAFzQCyYxaANNMgE5mUDmmAvNErwA7gyYAKAJR4CwKpwCuwJIQ4SS5BXUbNYbTtz5TssggTPQAvjhs4Q8JNCeDhYhMglvxxaTKQAdJoU1AEQjhIARGCRbNEARsCR-kGkIRBhEQCMAEwAzHFgiclAA