Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downlevel Awaited #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Newbie012
Copy link

Typescript 4.5 has introduced the Awaited type, which recursively extracts the value inside a promise.

@Newbie012
Copy link
Author

Newbie012 commented Jun 22, 2022

After some research, I discovered that this syntax uses Recursive Conditional Types which were introduced in version 4.1. Thus, it won't work for versions that are lower than 4.1.

I'm not sure how to proceed from here. Thoughts?

Copy link
Owner

@sandersn sandersn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awaited is a built-in type, but it doesn't use any new syntax. downlevel-dts is intended to make .d.ts files compatible with the syntax of old Typescript versions -- in most cases some semantics get lost, even.

I think the right fix for projects that need to support pre-4.5 versions is to provide their own copy of Awaited, perhaps only for people on pre-4.5 versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants