Skip to content

Cannot read property 'jsDocCache' of undefined crash on 4.2.2 #42957

Closed
@airhorns

Description

@airhorns

Bug Report

tsc crashes with a TypeError when compiling TS code with lots of JSDocs:

$ /Users/airhorns/Code/gadget/node_modules/.bin/tsc --noEmit
/Users/airhorns/Code/gadget/node_modules/typescript/lib/tsc.js:88051
                throw e;
                ^

TypeError: Cannot read property 'jsDocCache' of undefined
    at getJSDocTagsWorker (/Users/airhorns/Code/gadget/node_modules/typescript/lib/tsc.js:9124:25)
    at getFirstJSDocTag (/Users/airhorns/Code/gadget/node_modules/typescript/lib/tsc.js:9144:24)
    at Object.getJSDocDeprecatedTag (/Users/airhorns/Code/gadget/node_modules/typescript/lib/tsc.js:9066:16)
    at addDeprecatedSuggestionWorker (/Users/airhorns/Code/gadget/node_modules/typescript/lib/tsc.js:36388:119)
    at addDeprecatedSuggestion (/Users/airhorns/Code/gadget/node_modules/typescript/lib/tsc.js:36397:20)
    at checkAliasSymbol (/Users/airhorns/Code/gadget/node_modules/typescript/lib/tsc.js:64716:21)
    at checkImportBinding (/Users/airhorns/Code/gadget/node_modules/typescript/lib/tsc.js:64723:13)
    at Object.forEach (/Users/airhorns/Code/gadget/node_modules/typescript/lib/tsc.js:128:30)
    at checkImportDeclaration (/Users/airhorns/Code/gadget/node_modules/typescript/lib/tsc.js:64754:36)
    at checkSourceElementWorker (/Users/airhorns/Code/gadget/node_modules/typescript/lib/tsc.js:65176:28)
error Command failed with exit code 1.

🔎 Search Terms

TypeError jsdoccache getJSDocTagsWorker

🕗 Version & Regression Information

  • This is a crash
  • This changed between versions 4.2.1 and 4.2.2

💻 Code

I am not sure which file in my project is causing this crash -- is there a hidden verbose compiler option that would indicate which file it's working on?

My tsconfig:

{
    "compilerOptions": {
        "strict": true,
        "esModuleInterop": true,
        "allowJs": true,
        "noImplicitAny": true,
        "sourceMap": true,
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "forceConsistentCasingInFileNames": true,
        "useDefineForClassFields": true,
        "target": "es2020",
        "lib": [
            "es2020",
            "dom"
        ],
        "skipLibCheck": true,
        "resolveJsonModule": true,
        "baseUrl": "./",
        "moduleResolution": "node",
        "module": "commonjs",
        "jsx": "react",
        "types": [
            "jest",
            "@starscream/core/type-extensions/fastify-routes",
            "@starscream/core/type-extensions/pino",
            "@starscream/core/type-extensions/pino-pretty"
        ],
        "noEmit": true
    },
    "files": [ ... ],
    "include": [
        "./src",
        "./tools",
        "./spec",
        "./starscream.config.ts",
        "./types/gadget-fastify-extensions.d.ts"
    ],
    "exclude": [
        "node_modules",
        "spec/integration/typescript-client/fixtures"
    ]
}

🙁 Actual behavior

tsc crashes trying to compile an unspecified file

🙂 Expected behavior

tsc should succeed compiling the file or log an error to the console

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions