Skip to content

awaited operator doesn't work with type guards #37512

Closed
@falsandtru

Description

@falsandtru

@rbuckton

TypeScript Version: master

Search Terms:

Code

declare function isAwaited(value: any): value is awaited unknown;
function f<a>(a: a): void {
  isAwaited(a) && a;
}

Expected behavior:
The narrowed type of a is awaited a.
Actual behavior:
The narrowed type of a is a.

Playground Link:

Related Issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    In DiscussionNot yet reached consensusSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions