Skip to content

Get union of all possible return types of a function #20350

Closed
@bcherny

Description

@bcherny

For example:

type F = () => number | string
type G = returnof F // number | string

If there is interest, I will write up a proposal.

Note that this is distinct from #6606, which gives a return type given parameter types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    SuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions