D
Deno

help

cli/tsc crashes with Uncaught TypeError

PHPatrick (he/him)4/13/2023
Using latest Deno (1.32.4), this only happens on certain files, but it effectively means that I cannot do type checking with Deno now. The error (somewhat opaque since this looks like generated code):
error: Uncaught TypeError: Cannot read properties of undefined (reading 'kind')
at <anonymous> (internal:deno_tsc/tsc/00_typescript.js:19111:18)
error: Uncaught TypeError: Cannot read properties of undefined (reading 'kind')
at <anonymous> (internal:deno_tsc/tsc/00_typescript.js:19111:18)
appears to be happening on the first line of this function:
function getModifierFlagsWorker(node, includeJSDoc, alwaysIncludeJSDoc) {
if (node.kind >= 0 /* FirstToken */ && node.kind <= 162 /* LastToken */) {
return 0 /* None */;
}
if (!(node.modifierFlagsCache & 536870912 /* HasComputedFlags */)) {
node.modifierFlagsCache = getSyntacticModifierFlagsNoCache(node) | 536870912 /* HasComputedFlags */;
}
if (includeJSDoc && !(node.modifierFlagsCache & 4096 /* HasComputedJSDocModifiers */) && (alwaysIncludeJSDoc || isInJSFile(node)) && node.parent) {
node.modifierFlagsCache |= getJSDocModifierFlagsNoCache(node) | 4096 /* HasComputedJSDocModifiers */;
}
return node.modifierFlagsCache & ~(536870912 /* HasComputedFlags */ | 4096 /* HasComputedJSDocModifiers */);
}
function getModifierFlagsWorker(node, includeJSDoc, alwaysIncludeJSDoc) {
if (node.kind >= 0 /* FirstToken */ && node.kind <= 162 /* LastToken */) {
return 0 /* None */;
}
if (!(node.modifierFlagsCache & 536870912 /* HasComputedFlags */)) {
node.modifierFlagsCache = getSyntacticModifierFlagsNoCache(node) | 536870912 /* HasComputedFlags */;
}
if (includeJSDoc && !(node.modifierFlagsCache & 4096 /* HasComputedJSDocModifiers */) && (alwaysIncludeJSDoc || isInJSFile(node)) && node.parent) {
node.modifierFlagsCache |= getJSDocModifierFlagsNoCache(node) | 4096 /* HasComputedJSDocModifiers */;
}
return node.modifierFlagsCache & ~(536870912 /* HasComputedFlags */ | 4096 /* HasComputedJSDocModifiers */);
}
it's probably some syntax error in my code at the moment that's causing the crash. If I git stash the error goes away ok I figured it out. Seems like it is a bug in the cli/tsc code. If I use Parameters<typeof someValue["someProperty"]>[1] in a function's parameters, it crashes. However, if I assign that type to a type alias (e.g. type Param1 = Parameters<typeof someValue["someProperty"]>[1]) then use that alias in the function's parameters, no crash. Not too bad, makes my code more readable anyway.
Llcasdev4/15/2023
Can you share the project this is happening in? cc @dsherret Oh I see you figured it out already. May be worth opening an issue in the TypeScript repo

Looking for more? Join the community!

Recommended Posts
Fresh: <Head> component is not supportedWhen running `deno task start` with this as my `pages/index.tsx` file (as in the demo) I'm seeing tIs there a way to vendor npm specifier imports?> deno vendor npm:express > Vendored 0 modules into scripts/vendor directoryHow can I import with npm: specifiers through a proxy?My company blocks npmjs.com and they have setup an internal Artifactory instance. With nodejs I can Import modules from all files in directoryConsidering I have multiple ts files in a folder and all of them export the same type module. Can I Parsing Apache mime.types into dictionary Record<string, string>This code parses the official Apache `mime.types` from GitHub and creates a dictionary `Record<strinProvide own default error page in FreshHello! I'm seeing the following error ```pragma cannot be set when runtime is automatic at https:/Smoother DX using 3rd party modules written in TypeScript in the BrowserSay, for instance, I want to use the "async" standard library's Deferred implementation in some codegrpc / http2 / https in fresh.please a correct way to use grpc / http2 / https in fresh.Importing local Node.js modulesI have a local Node.js/TS package in local directory `/foo/bar/leet/package.json` – Is there any wayServer Sent Events with FreshHi! I am trying to use Server Sent Events (SSE) with fresh. I understand I should have an island thaTwind intellisense stop workingOut of the blue, intellisense stopped working even though I installed the twind and deno extensions How use namespace on Denoi am trying to use the same namespace in multiple modules but what used to work in node, doesn't wor