Skip to content

noImplicitAny ignored on generic type resolution #33279

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions