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

Upgrade Babel parser to support Typescript 5.0 #788

Merged
merged 2 commits into from Jun 27, 2023

Conversation

Karfroth
Copy link
Contributor

This PR upgrades Babel parser to 7.21.3, which supports Typescript 5.0. As it is minor version upgrade, I would expect that there will be no breaking changes.

This will help checking the typescript files with new keywords, such as satisfies. Hence, this PR can fix #768

To ensure the new syntex support, this PR also adds a simple function to the index.ts file in the test.

@jportner
Copy link

I tried using this upgraded dependency (via a yarn dependency resolution) and it seems to have completely broken TypeScript parsing on my project. I get a bunch of "TypeError: p is not iterable" errors as a result.

It seems this was a previously documented issue (#688) and it was fixed in depcheck 1.4.3 by pinning @babel/parser to exactly 7.6.14. There's a related discussion here too (#687).

TL;DR unfortunately it seems that upgrading @babel/parser to 7.21.3 re-introduces this problem :(

@Karfroth
Copy link
Contributor Author

Karfroth commented Apr 13, 2023

Thanks for the comment. I will try to find the fundamental solution.

@Karfroth
Copy link
Contributor Author

@jportner I tried to dig more and I believe this PR will not cause the same issue again. because the fix for the root cause is already merged to the main branch with #745

@jportner
Copy link

@jportner I tried to dig more and I believe this PR will not cause the same issue again. because the fix for the root cause is already merged to the main branch with #745

Oh I see, that has been merged but not released yet.
I was wondering why your unit test passed!

Thanks for double-checking, and apologies for the false alarm 😄

@danieleformichelli
Copy link

@rumpl / @jportner do you think we can merge this and get a new release to fix support for TS5? 🙏

@seansfkelley
Copy link
Contributor

As a workaround, if you're using Yarn, you can both peg the resolved version of the Babel parser (a la #788 (comment)) and then yarn patch depcheck to manually patch in the fix to #688, which is thankfully very easy to apply in the transpiled .js.

@znarf znarf changed the title Upgrade Bebel parser to support Typescript 5.0 Upgrade Babel parser to support Typescript 5.0 Jun 8, 2023
package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
Copy link
Collaborator

@znarf znarf left a comment

Choose a reason for hiding this comment

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

Good for me.

@danieleformichelli
Copy link

@znarf @jportner is there any blocker for merging and releasing this? 🙏

@rumpl
Copy link
Member

rumpl commented Jun 27, 2023

@znarf @jportner is there any blocker for merging and releasing this? 🙏

None, I’ll do it this weekend when I get back from my PTO

@rumpl rumpl merged commit 4b23f8b into depcheck:main Jun 27, 2023
4 checks passed
@danieleformichelli
Copy link

Thanks for merging this @rumpl 🙏
Do you think we can do a release containing this change? 🙏

@jtbandes
Copy link
Contributor

I'm also waiting for this change to be released 🎉 thank you!

jtbandes added a commit to foxglove/studio that referenced this pull request Jul 20, 2023
jtbandes added a commit to foxglove/studio that referenced this pull request Jul 21, 2023
**User-Facing Changes**
None

**Description**
ts-prune has gone into maintenance mode and is using some old
dependencies that block us from using new TS features like `satisfies`
(nadeesha/ts-prune#218).

Also considered [`unimported`](https://github.com/smeijer/unimported)
but it seems nice to have the ability to invoke it a library.

https://npmtrends.com/ts-prune-vs-ts-unused-exports-vs-unimported

This PR also includes a patch to `depcheck` to get `satisfies` support
(the issues have already been fixed on main but it hasn't been released
yet): depcheck/depcheck#788
@PeKne
Copy link

PeKne commented Jul 25, 2023

Thank you for fixing this. Looking forward to the release 🙏.

@pkishorez
Copy link

@rumpl thanks a lot for your efforts.
I could see some changes merged to main, yet no release created since last year!
Is there any issue regarding the same?

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.

Breaks when using satisfies operator in TypeScript
9 participants