Skip to content

Widening after inferring null or undefined for a type parameter should be an implicit any #531

Open
@mhegazy

Description

@mhegazy

Courtesy of @JsonFreeman

function f<T>(t: T): T { return null }
f(null);

When compiling with -noImplicitAny, we don't get an error here, even though T is implicitly inferred to be any when we call f

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Help WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions