Skip to content

Argument becomes implicit any when a void-returning overload follows a non-void-returning signature #48088

@JoshuaKGoldberg

Description

@JoshuaKGoldberg

Bug Report

🔎 Search Terms

overload argument type signature

🕗 Version & Regression Information

⏯ Playground Link

Playground link with relevant code

💻 Code

declare const it: {
    (test: () => Promise<void>): void;
    (test: (input: string) => void): void;
}

it((input) => {
    input.toUpperCase();
});

it(async () => {
    // ..
});

🙁 Actual behavior

Error: Parameter 'input' implicitly has an 'any' type.

🙂 Expected behavior

No type error. The input parameter is type string and should be resolved as such.

For more context, see DefinitelyTyped/DefinitelyTyped#59075.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.SuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions