Skip to content

Debug Failure. This is unknown parent for type parameter: 190 (/192) #50939

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

Closed
jeengbe opened this issue Sep 24, 2022 · 2 comments · Fixed by #52032
Closed

Debug Failure. This is unknown parent for type parameter: 190 (/192) #50939

jeengbe opened this issue Sep 24, 2022 · 2 comments · Fixed by #52032
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@jeengbe
Copy link

jeengbe commented Sep 24, 2022

Bug Report

🔎 Search Terms

Debug Failure.
This is unknown parent for type parameter: 190 (for 4.8.3)
This is unknown parent for type parameter: 192 (for 4.9.0-dev.20220924)
getTypeParameterConstraintVisibilityError
type constraints

🕗 Version & Regression Information

  • This is a crash
  • This changed between versions ______ and _______
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
  • I was unable to test this on prior versions because _______

Tested with 4.8.3 and 4.9.0-dev.20220924.

⏯ Playground Link

Unfortunately, I have not been able to compile a sample to reproduce the error, as I have not ventured deep enough into its cause.
However, I can reliably make it crash in my code where I originally found it:
https://github.com/jeengbe/vality/tree/dev/src/lib/parse.ts

💻 Code

  1. Remove the following import:
diff --git a/src/lib/parse.ts b/src/lib/parse.ts
index 0dd2292..71937b9 100644
--- a/src/lib/parse.ts
+++ b/src/lib/parse.ts
@@ -1,4 +1,4 @@
-import { Eny, IntersectItems, OneOrEnumOfTOrFace } from "./utils";
+import { Eny, IntersectItems } from "./utils";
 import { Face } from "./validate";
 
 // Depending on the direction of the required type, we parse relations differently

And voilà, observe the following error in tsserver log:

Info 49   [20:51:04.256] event:
    {"seq":0,"type":"event","event":"syntaxDiag","body":{"file":"/home/coder/data/vality/src/lib/parse.ts","diagnostics":[]}}
Err 50    [20:51:04.476] Exception on executing command delayed processing of request 3:

    Debug Failure. This is unknown parent for type parameter: 190

    Error: Debug Failure. This is unknown parent for type parameter: 190
        at getTypeParameterConstraintVisibilityError (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:109359:37)
        at handleSymbolAccessibilityError (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:109532:33)
        at checkEntityNameVisibility (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:109985:13)
        at visitDeclarationSubtree (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:110174:25)
        at visitNode (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:90384:23)
        at Object.visitEachChild (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:90638:173)
        at visitDeclarationSubtree (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:110245:43)
        at visitNode (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:90384:23)
        at Object.visitEachChild (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:90725:58)
        at visitDeclarationSubtree (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:110276:31)
        at visitArrayWorker (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:90473:48)
        at visitNodes (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:90436:23)
        at Object.visitEachChild (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:90707:58)
        at visitDeclarationSubtree (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:110276:31)
        at visitArrayWorker (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:90473:48)
        at visitNodes (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:90436:23)
        at Object.visitEachChild (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:90689:116)
        at visitDeclarationSubtree (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:110175:39)
        at Object.visitNode (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:90384:23)
        at visitDeclarationSubtree (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:110251:46)
        at Object.visitNode (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:90384:23)
        at visitDeclarationSubtree (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:110256:44)
        at Object.visitNode (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:90384:23)
        at visitDeclarationSubtree (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:110256:44)
        at Object.visitNode (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:90384:23)
        at transformTopLevelDeclaration (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:110388:210)
        at visitDeclarationStatements (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:110341:26)
        at visitArrayWorker (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:90473:48)
        at Object.visitNodes (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:90436:23)
        at transformRoot (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:109704:37)
        at transformation (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:110993:24)
        at transformRoot (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:111020:82)
        at Object.transformNodes (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:111004:78)
        at Object.getDeclarationDiagnostics (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:109411:25)
        at /home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:119306:27
        at runWithCancellationToken (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:119003:24)
        at getDeclarationDiagnosticsForFileNoCache (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:119303:20)
        at getAndCacheDiagnostics (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:119317:26)
        at getDeclarationDiagnosticsWorker (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:119300:20)
        at getDeclarationDiagnosticsForFile (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:119327:56)
        at getDiagnosticsHelper (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:118945:24)
        at Object.getDeclarationDiagnostics (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:118987:24)
        at Object.getSemanticDiagnostics (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:167285:50)
        at IpcIOSession.Session.semanticCheck (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:178569:52)
        at /home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:178635:31
        at MultistepOperation.executeAction (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:177493:25)
        at /home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:177472:100
        at IpcIOSession.Session.executeWithRequestId (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:180157:28)
        at Object.executeWithRequestId (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:178333:87)
        at Immediate._onImmediate (/home/coder/data/vality/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsserver.js:177472:41)
        at processImmediate (node:internal/timers:466:21)

For 4.9.0-dev.20220924 the id of the received node appears to be 192.

🙁 Actual behavior

error in log.

This causes tsserver to disregard semantic errors in that very file.

🙂 Expected behavior

no error in log.

@RyanCavanaugh RyanCavanaugh added this to the TypeScript 4.9.0 milestone Sep 26, 2022
@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Sep 26, 2022
@justinyaodu
Copy link

When I encountered a similar crash, I commented out "declaration": true from my tsconfig.json and tsc gave me type errors instead, similar to #25456. Once I fixed those type errors (I forgot to import some types), I uncommented "declaration": true and tsc compiled successfully again.

@JoshuaKGoldberg
Copy link
Contributor

JoshuaKGoldberg commented Dec 27, 2022

Edit: here's a much more trim reproduction:

type Test<T> = T extends infer A extends B ? number : string;

Here, too, declaration must be enabled in the TSConfig for the error.


Here's a trimmed down reproduction:

type AnyRouter = () => any;

type RouterToParams<T> = T;

export function mergeRouters<TRouters extends [...AnyRouter[]]>(
  ...routerList: TRouters
): RouterToParams<TRouters> extends infer AllParams extends AnyRouterParams[]
  ? string : never {
}

Note that AnyRouterParams does not exist in the snippet. There should be a TypeScript error about identifier/name not being found, not an uncaught error visible in browser dev tools console:

Uncaught (in promise) Error: Debug Failure. This is unknown parent for type parameter: 192

Originally spotted in the build for trpc/trpc#3502. That build has ts.SyntaxKind[190], InferType, hitting on AllParams extends AnyRouterParams[]. It's roughly the same syntax area.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants