Skip to content

noImplicitAny incorrectly permits 'any' when returned via arrow function #7220

Open
@myitcv

Description

@myitcv

Apologies for the vague title, I can't quite pin down the cause of this, hence the poor wording

$ tsc --version
1.9.0-dev.20160208

The problem is best described using the following example:

// using --noImplicitAny

let a = undefined;  // OK: error as expected: Variable 'a' implicitly has an 'any' type.

function mine<T>(meth: () => T): T {
    return meth();
}

// **Problem**: x has type 'any' below
// Should be a compiler error
let x = mine(() => {
    return undefined;
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions