Skip to content

Regression in type inference? #12733

Closed
Closed
@olydis

Description

@olydis

TypeScript Version: 2.1.1, 2.1.4

Code

declare function func(callback: () => void): any;
declare function func(callback: (arg: number) => void): any;

func(argx => { });

Expected behavior:
Successfully compile, even if --noImplicitAny is set. This is the behavior we saw until 2.0.10 (which appears reasonable, the second overload of func allows inferring that argx: number).

Actual behavior:
error TS7006: Parameter 'argx' implicitly has an 'any' type

Metadata

Metadata

Assignees

No one assigned

    Labels

    Breaking ChangeWould introduce errors in existing codeFix AvailableA PR has been opened for this issueWorking as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions