Skip to content

Promise<void> should not require to pass undefined #8516

@tinganho

Description

@tinganho

One should only need to write:

function test(): Promise<void> {
    return Promise.resolve(); // error type '{}' is not assignable to type 'void'
}

Though this produces the error

type '{}' is not assignable to type 'void'.

The current solution to silence the compiler is to pass undefined:

function test(): Promise<void> {
    return Promise.resolve(undefined);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions