Skip to content

TS target 2022 doesn't allow CancelablePromise as a return type in async functions #1868

Description

@akindo

With a target of ES2022 in tsconfig.json, TypeScript v. 5.0.2 doesn't allow CancelablePromise as a return type in an async function:

async hello(): CancelablePromise<string> {
    return new CancelablePromise((resolve) => void resolve('hello'));
}

image

The error isn't present with a target of es5.

Thanks for any help. :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions