Skip to content

Extra arguments with defaults get implicit any even with noImplicitAny #17904

Closed
@steadicat

Description

@steadicat

TypeScript Version: 2.4.2

Code

function foo(f: (x: number) => void) {}
foo((x, arg = true) => {});

Tested in Playground with noImplicitAny on.

Expected behavior:
Type of arg is inferred to be boolean, or an error is thrown ("arg implicitly has 'any' type").

Actual behavior:
Type of arg is any, and no error is thrown.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions