-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
tsc 4.5 hangs with unist-util-visit package (works fine with 4.4.4) #46900
Comments
Sample call stack while stuck isSimpleTypeRelatedTo (checker.ts:17773) isRelatedTo (checker.ts:18270) typeRelatedToSomeType (checker.ts:18585) structuredTypeRelatedToWorker (checker.ts:18861) structuredTypeRelatedTo (checker.ts:18842) isRelatedTo (checker.ts:18311) checkTypeRelatedTo (checker.ts:17898) isTypeRelatedTo (checker.ts:17836) isTypeAssignableTo (checker.ts:16981) getSimplifiedConditionalType (checker.ts:15445) getSimplifiedType (checker.ts:15357) getSimplifiedTypeOrConstraint (checker.ts:11730) getConstraintFromIndexedAccess (checker.ts:11742) getConstraintOfIndexedAccess (checker.ts:11726) getConstraintOfType (checker.ts:11716) getSimplifiedTypeOrConstraint (checker.ts:11731) getConstraintFromIndexedAccess (checker.ts:11742) getConstraintOfIndexedAccess (checker.ts:11726) getConstraintOfType (checker.ts:11716) getEffectiveConstraintOfIntersection (checker.ts:11802) isRelatedTo (checker.ts:18335) typeRelatedToSomeType (checker.ts:18585) structuredTypeRelatedToWorker (checker.ts:18861) structuredTypeRelatedTo (checker.ts:18842) isRelatedTo (checker.ts:18311) checkTypeRelatedTo (checker.ts:17898) isTypeRelatedTo (checker.ts:17836) isTypeAssignableTo (checker.ts:16981) getSimplifiedConditionalType (checker.ts:15445) getSimplifiedType (checker.ts:15357) getSimplifiedTypeOrConstraint (checker.ts:11730) getConstraintFromIndexedAccess (checker.ts:11742) getConstraintOfIndexedAccess (checker.ts:11726) getConstraintOfType (checker.ts:11716) getSimplifiedTypeOrConstraint (checker.ts:11731) getConstraintFromIndexedAccess (checker.ts:11742) getConstraintOfIndexedAccess (checker.ts:11726) getConstraintOfType (checker.ts:11716) getEffectiveConstraintOfIntersection (checker.ts:11802) isRelatedTo (checker.ts:18335) isRelatedTo (checker.ts:18339) checkTypeRelatedTo (checker.ts:17898) isTypeRelatedTo (checker.ts:17836) isTypeAssignableTo (checker.ts:16981) getSimplifiedConditionalType (checker.ts:15445) getSimplifiedType (checker.ts:15357) getSimplifiedTypeOrConstraint (checker.ts:11730) getConstraintFromIndexedAccess (checker.ts:11742) getConstraintOfIndexedAccess (checker.ts:11726) getConstraintOfType (checker.ts:11716) getSimplifiedTypeOrConstraint (checker.ts:11731) getConstraintFromIndexedAccess (checker.ts:11742) getConstraintOfIndexedAccess (checker.ts:11726) getConstraintOfType (checker.ts:11716) getSimplifiedTypeOrConstraint (checker.ts:11731) getConstraintFromIndexedAccess (checker.ts:11742) getConstraintOfIndexedAccess (checker.ts:11726) getConstraintOfType (checker.ts:11716) getSimplifiedTypeOrConstraint (checker.ts:11731) getConstraintFromIndexedAccess (checker.ts:11742) getConstraintOfIndexedAccess (checker.ts:11726) getConstraintOfType (checker.ts:11716) getEffectiveConstraintOfIntersection (checker.ts:11802) isRelatedTo (checker.ts:18335) isRelatedTo (checker.ts:18339) isRelatedTo (checker.ts:18339) isRelatedTo (checker.ts:18339) isRelatedTo (checker.ts:18339) isRelatedTo (checker.ts:18339) isRelatedTo (checker.ts:18339) checkTypeRelatedTo (checker.ts:17898) isTypeRelatedTo (checker.ts:17836) isTypeAssignableTo (checker.ts:16981) getSimplifiedConditionalType (checker.ts:15445) getSimplifiedType (checker.ts:15357) getSimplifiedTypeOrConstraint (checker.ts:11730) getConstraintFromIndexedAccess (checker.ts:11742) getConstraintOfIndexedAccess (checker.ts:11726) getConstraintOfType (checker.ts:11716) getSimplifiedTypeOrConstraint (checker.ts:11731) getConstraintFromIndexedAccess (checker.ts:11742) getConstraintOfIndexedAccess (checker.ts:11726) getConstraintOfType (checker.ts:11716) getEffectiveConstraintOfIntersection (checker.ts:11802) isRelatedTo (checker.ts:18335) checkTypeRelatedTo (checker.ts:17898) isTypeRelatedTo (checker.ts:17836) isTypeAssignableTo (checker.ts:16981) getSimplifiedConditionalType (checker.ts:15445) getSimplifiedType (checker.ts:15357) getSimplifiedTypeOrConstraint (checker.ts:11730) getConstraintFromIndexedAccess (checker.ts:11742) getConstraintOfIndexedAccess (checker.ts:11726) getConstraintOfType (checker.ts:11716) getSimplifiedTypeOrConstraint (checker.ts:11731) getConstraintFromIndexedAccess (checker.ts:11742) getConstraintOfIndexedAccess (checker.ts:11726) getConstraintOfType (checker.ts:11716) getEffectiveConstraintOfIntersection (checker.ts:11802) isRelatedTo (checker.ts:18335) typeRelatedToSomeType (checker.ts:18585) structuredTypeRelatedToWorker (checker.ts:18861) structuredTypeRelatedTo (checker.ts:18842) recursiveTypeRelatedTo (checker.ts:18808) isRelatedTo (checker.ts:18314) isRelatedTo (checker.ts:18339) isRelatedTo (checker.ts:18339) checkTypeRelatedTo (checker.ts:17898) isTypeRelatedTo (checker.ts:17836) isTypeAssignableTo (checker.ts:16981) getSimplifiedConditionalType (checker.ts:15445) getSimplifiedType (checker.ts:15357) getNormalizedType (checker.ts:17851) isRelatedTo (checker.ts:18233) checkTypeRelatedTo (checker.ts:17898) isTypeRelatedTo (checker.ts:17836) isTypeAssignableTo (checker.ts:16981) instantiateTypeWorker (checker.ts:16828) instantiateTypeWithAlias (checker.ts:16766) instantiateType (checker.ts:16748) instantiateList (checker.ts:16340) instantiateTypes (checker.ts:16357) instantiateTypeWorker (checker.ts:16794) instantiateTypeWithAlias (checker.ts:16766) instantiateType (checker.ts:16748) getTrueTypeFromConditionalType (checker.ts:15730) getSimplifiedConditionalType (checker.ts:15433) getSimplifiedType (checker.ts:15357) getImmediateBaseConstraint (checker.ts:11880) getBaseConstraint (checker.ts:11901) computeBaseConstraint (checker.ts:11917) getImmediateBaseConstraint (checker.ts:11880) getBaseConstraint (checker.ts:11901) computeBaseConstraint (checker.ts:11955) getImmediateBaseConstraint (checker.ts:11880) getResolvedBaseConstraint (checker.ts:11864) getBaseConstraintOfType (checker.ts:11836) getApparentType (checker.ts:12036) createUnionOrIntersectionProperty (checker.ts:12069) getUnionOrIntersectionProperty (checker.ts:12221) getPropertyOfUnionOrIntersectionType (checker.ts:12233) getPropertiesOfUnionOrIntersectionType (checker.ts:11650) getReducedType (checker.ts:12251) getNormalizedType (checker.ts:17849) isRelatedTo (checker.ts:18234) checkTypeRelatedTo (checker.ts:17898) isTypeRelatedTo (checker.ts:17836) isTypeAssignableTo (checker.ts:16981) instantiateTypeWorker (checker.ts:16828) instantiateTypeWithAlias (checker.ts:16766) instantiateType (checker.ts:16748) instantiateTypeWorker (checker.ts:16816) instantiateTypeWithAlias (checker.ts:16766) instantiateType (checker.ts:16748) getConditionalType (checker.ts:15692) getConditionalTypeInstantiation (checker.ts:16737) instantiateTypeWorker (checker.ts:16819) instantiateTypeWithAlias (checker.ts:16766) instantiateType (checker.ts:16748) getTrueTypeFromConditionalType (checker.ts:15730) getSimplifiedConditionalType (checker.ts:15433) getSimplifiedType (checker.ts:15357) getConstraintOfDistributiveConditionalType (checker.ts:11775) structuredTypeRelatedToWorker (checker.ts:19263) structuredTypeRelatedTo (checker.ts:18842) recursiveTypeRelatedTo (checker.ts:18808) isRelatedTo (checker.ts:18317) eachTypeRelatedToType (checker.ts:18655) structuredTypeRelatedToWorker (checker.ts:18858) structuredTypeRelatedTo (checker.ts:18842) isRelatedTo (checker.ts:18311) structuredTypeRelatedToWorker (checker.ts:19265) structuredTypeRelatedTo (checker.ts:18842) recursiveTypeRelatedTo (checker.ts:18808) isRelatedTo (checker.ts:18317) eachTypeRelatedToType (checker.ts:18655) structuredTypeRelatedToWorker (checker.ts:18858) structuredTypeRelatedTo (checker.ts:18842) isRelatedTo (checker.ts:18311) structuredTypeRelatedToWorker (checker.ts:19265) structuredTypeRelatedTo (checker.ts:18842) recursiveTypeRelatedTo (checker.ts:18808) isRelatedTo (checker.ts:18317) eachTypeRelatedToType (checker.ts:18655) structuredTypeRelatedToWorker (checker.ts:18858) structuredTypeRelatedTo (checker.ts:18842) isRelatedTo (checker.ts:18311) structuredTypeRelatedToWorker (checker.ts:19265) structuredTypeRelatedTo (checker.ts:18842) recursiveTypeRelatedTo (checker.ts:18808) isRelatedTo (checker.ts:18317) eachTypeRelatedToType (checker.ts:18655) structuredTypeRelatedToWorker (checker.ts:18858) structuredTypeRelatedTo (checker.ts:18842) isRelatedTo (checker.ts:18311) structuredTypeRelatedToWorker (checker.ts:19265) structuredTypeRelatedTo (checker.ts:18842) recursiveTypeRelatedTo (checker.ts:18808) isRelatedTo (checker.ts:18317) eachTypeRelatedToType (checker.ts:18655) structuredTypeRelatedToWorker (checker.ts:18858) structuredTypeRelatedTo (checker.ts:18842) isRelatedTo (checker.ts:18311) structuredTypeRelatedToWorker (checker.ts:19265) structuredTypeRelatedTo (checker.ts:18842) recursiveTypeRelatedTo (checker.ts:18808) isRelatedTo (checker.ts:18317) eachTypeRelatedToType (checker.ts:18655) structuredTypeRelatedToWorker (checker.ts:18858) structuredTypeRelatedTo (checker.ts:18842) isRelatedTo (checker.ts:18311) structuredTypeRelatedToWorker (checker.ts:19265) structuredTypeRelatedTo (checker.ts:18842) recursiveTypeRelatedTo (checker.ts:18808) isRelatedTo (checker.ts:18317) structuredTypeRelatedToWorker (checker.ts:19265) structuredTypeRelatedTo (checker.ts:18842) recursiveTypeRelatedTo (checker.ts:18808) isRelatedTo (checker.ts:18317) structuredTypeRelatedToWorker (checker.ts:19276) structuredTypeRelatedTo (checker.ts:18842) recursiveTypeRelatedTo (checker.ts:18808) isRelatedTo (checker.ts:18317) typeRelatedToEachType (checker.ts:18601) structuredTypeRelatedToWorker (checker.ts:18864) structuredTypeRelatedTo (checker.ts:18842) recursiveTypeRelatedTo (checker.ts:18808) isRelatedTo (checker.ts:18314) checkTypeRelatedTo (checker.ts:17898) isTypeRelatedTo (checker.ts:17836) isTypeAssignableTo (checker.ts:16981) instantiateTypeWorker (checker.ts:16828) instantiateTypeWithAlias (checker.ts:16766) instantiateType (checker.ts:16748) getTrueTypeFromConditionalType (checker.ts:15730) inferToConditionalType (checker.ts:22199) invokeOnce (checker.ts:21988) inferFromTypes (checker.ts:21920) inferFromContravariantTypes (checker.ts:22037) applyToParameterTypes (checker.ts:21318) inferFromSignature (checker.ts:22345) inferFromSignatures (checker.ts:22335) inferFromObjectTypes (checker.ts:22311) invokeOnce (checker.ts:21988) inferFromTypes (checker.ts:21956) inferTypes (checker.ts:21749) inferTypeArguments (checker.ts:29330) chooseOverload (checker.ts:30152) resolveCall (checker.ts:29968) resolveCallExpression (checker.ts:30409) resolveSignature (checker.ts:30859) getResolvedSignature (checker.ts:30891) checkCallExpression (checker.ts:31022) checkExpressionWorker (checker.ts:34070) checkExpression (checker.ts:33968) checkExpressionStatement (checker.ts:37036) checkSourceElementWorker (checker.ts:40284) checkSourceElement (checker.ts:40152) forEach (core.ts:66) checkBlock (checker.ts:36539) checkSourceElementWorker (checker.ts:40280) checkSourceElement (checker.ts:40152) checkFunctionExpressionOrObjectLiteralMethodDeferred (checker.ts:32207) checkDeferredNode (checker.ts:40462) checkDeferredNodes (checker.ts:40438) checkSourceFileWorker (checker.ts:40528) checkSourceFile (checker.ts:40485) getDiagnosticsWorker (checker.ts:40599) getDiagnostics (checker.ts:40583) (anonymous) (program.ts:2014) runWithCancellationToken (program.ts:1966) getBindAndCheckDiagnosticsForFileNoCache (program.ts:1999) getAndCacheDiagnostics (program.ts:2305) getBindAndCheckDiagnosticsForFile (program.ts:1995) getSemanticDiagnosticsForFile (program.ts:1989) (anonymous) (program.ts:1906) flatMap (core.ts:412) getDiagnosticsHelper (program.ts:1902) getSemanticDiagnostics (program.ts:1915) emitFilesAndReportErrors (watch.ts:329) emitFilesAndReportErrorsAndGetExitStatus (watch.ts:372) performCompilation (executeCommandLine.ts:776) executeCommandLineWorker (executeCommandLine.ts:570) executeCommandLine (executeCommandLine.ts:666) (anonymous) (tsc.ts:21) Module._compile (internal/modules/cjs/loader.js:1065) Module._extensions..js (internal/modules/cjs/loader.js:1097) Module.load (internal/modules/cjs/loader.js:933) Module._load (internal/modules/cjs/loader.js:774) executeUserEntryPoint (internal/modules/run_main.js:72) (anonymous) (internal/main/run_main_module.js:17) |
We're trying to relate this source
to this target
originating (way up in the call stack at this call) visit(tree, "element", function onElement(node, index, parent) {
// noop
}) After much preamble, we stack up an increasing number of frames here in const constraint = getEffectiveConstraintOfIntersection(source.flags & TypeFlags.Intersection ? (source as IntersectionType).types: [source], !!(target.flags & TypeFlags.Union));
if (constraint && (source.flags & TypeFlags.Intersection || target.flags & TypeFlags.Union)) {
if (everyType(constraint, c => c !== source)) { // Skip comparison if expansion contains the source itself
// TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
if (result = isRelatedTo(constraint, target, RecursionFlags.Source, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
// infinite recursion here ^^^^^^^^^^^
resetErrorInfo(saveErrorInfo);
}
}
} |
since this is a bug with 4.5 shouldn't this be targeted as a patch for 4.5? |
@PabloSzx depends on the fix. We can't backport every fix but if this is being commonly encountered we'll look into it |
microsoft/TypeScript#46900 is freezing `npm run build`.
Also fixes rehype-shiki types See: microsoft/TypeScript#46900'
Excuse me, what is the current solution? I've looked at everything and I still can't find a solution. I don't have a typescript project right now. |
In a similar situation to @SilvaQ here :/ Switched away from vscode and still hangs too |
Is there any progress? The whole business is on the verge of collapse, please tell me how to save this disaster! |
I think this could be a temporary solution。 steps:
I installed the specified version of the current project: yarn add typescript@4.4.4 Modified the vscode configuration file: ... other fields here ....
"typescript.tsdk": "./node_modules/typescript/lib" problem off for me now. |
@SilvaQ that seemed to work! Intellisense ain't working yet, but at least it isn't hanging. Thanks!! |
@SilvaQ This also worked for me. I'm not sure if I have the same dependency but I'm experiencing the same behavior with typescript version 4.5. It will just hang forever. Until I updated the tsdk property in my settings to be the local typescript in node_modules it would often never show linting errors or intellisense would lag indefinitely. Question? Shouldn't using the local typescript version be the default? I would think that my editor should lint/etc with the version of typescript that matches the version I am using for compilation. |
I just ran in to this on my composite projects repo, https://github.com/NullVoxPopuli/ember-apply I have no idea what it's getting stuck on though.
I'm using |
Friendly ping @weswigham & @RyanCavanaugh, as the TypeScript v4.6 is coming soon, and you recently released the beta release is there is any chance that this bug fix is included in v4.6. I can't upgrade (still on v4.4) because of this in one of my project. Could we have some update on what is blocking for this, what are the issues and how can we help? |
Facing similar problem, bumping for visibility. |
was banging my head against the wall with this one. thanks. |
Forking this repo and using a different package manager which does not respect the existing package-lock file will cause ts 4.5 to be installed, which [hangs during build](microsoft/TypeScript#46900).
Bug Report
the following example makes
tsc
hang indefinitely with version 4.5, but compiles fine with 4.4.4:example: https://github.com/stefanprobst/issue-tsc
also see the discussion here: unifiedjs/unified#175
🔎 Search Terms
hangs
🕗 Version & Regression Information
tsc
hangs, but does not give an error message@next
version)⏯ Playground Link
link to a reproduction repo above
💻 Code
🙁 Actual behavior
tsc
hangs indefinitely without error message🙂 Expected behavior
tsc
finishing compilation, or giving indication what's wrongThe text was updated successfully, but these errors were encountered: