unist-util-visit: Causes tsc to stall indefinitely
Initial checklist
- I read the support docs
- I read the contributing guide
- I agree to follow the code of conduct
- I searched issues and couldn’t find anything (or linked relevant results below)
Affected packages and versions
4.1.0
Link to runnable example
No response
Steps to reproduce
clone https://github.com/cjroebuck/next-build-stalled
npm i
npx tsc
typescript version 4.5.2
(typescript version 4.4.3 does build ok)
Expected behavior
build shouldn’t stall
Actual behavior
build stalls indefinitely
In order to get the build to pass, comment out this line
I suspect it’s an issue with the unist-util-visit types?
Runtime
Node v16
Package manager
npm v7
OS
macOS
Build and bundle tools
Next.js
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 5
- Comments: 16 (5 by maintainers)
Commits related to this issue
- fix: Pin `unist-util-visit` to 4.0.0 to fix tcs issue Related: https://github.com/syntax-tree/unist-util-visit/issues/33 — committed to ExpediaGroup/insights-explorer by baumandm 2 years ago
Alternative to pinning typescript version - you can pin
unist-util-visit
to4.0.0
and also avoid the tsc hang.This has been resolved in TypeScript 4.6 https://devblogs.microsoft.com/typescript/announcing-typescript-4-6/#improved-recursion-depth-checks The fix has also been backported to 4.5
For anyone using pnpm:
https://github.com/Saul-Mirone/milkdown/blob/main/.pnpmfile.cjs
I think this could be a temporary solution。 The idea is to solve the problem by switching versions of typescript。 Modify the default typescript mode of vscode as shown in the documentation below: using-the-workspace-version-of-typescript
steps:
I installed the specified version of the current project:
Modified the vscode configuration file:
problem off for me now.
Thanks for reaching out @cjroebuck and @benatkin! Sorry you ran into a spot of trouble. This is indeed an issue in TypeScript, @stefanprobst also caught it in https://github.com/unifiedjs/unified/discussions/175 and narrowed it down to being a bug which was reported in TypeScript microsoft/TypeScript#46900 (which you’ve noted as well). We’re all waiting for a fix in TypeScript. Pinning the TypeScript version to 4.4.3 is the work around for now.