Skip to content

Union returntype with void must return a value #6326

Closed
@Pajn

Description

@Pajn

I have a method declared as stop(): void|Promise<void> {} which get the error

A function whose declared type is neither 'void' nor 'any' must return a value

As void is a valid return type I would expect that to be fully valid code. Specifying only void is working.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedA PR has been merged for this issueGood First IssueWell scoped, documented and has the green lightHelp WantedYou can do thisSpecIssues related to the TypeScript language specificationSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions