vuejs / language-tools

⚡ High-performance Vue language tooling based-on Volar.js
https://marketplace.visualstudio.com/items?itemName=Vue.volar
MIT License
5.85k stars 397 forks source link

TS 5 | Maximum call stack size exceeded #2689

Closed seahindeniz closed 5 months ago

seahindeniz commented 1 year ago

I got error after upgrading to latest versions of dependencies. It is a private project so, I'm not able to share a repro-repo

npm run type-check

> skeleton-design-bundle@0.1.0 type-check
> vue-tsc --noEmit -p tsconfig.app.json --composite false

/Users/sahindeniz/projects/2022.05.08-insider/skeleton-design-bundle/node_modules/vue-tsc/bin/vue-tsc.js:53
                        throw err;
                        ^

RangeError: Maximum call stack size exceeded
    at getSignatureFromDeclaration (/Users/sahindeniz/projects/2022.05.08-insider/skeleton-design-bundle/node_modules/typescript/lib/typescript.js:56488:41)
    at getExplicitThisType (/Users/sahindeniz/projects/2022.05.08-insider/skeleton-design-bundle/node_modules/typescript/lib/typescript.js:68364:27)
    at getTypeOfDottedName (/Users/sahindeniz/projects/2022.05.08-insider/skeleton-design-bundle/node_modules/typescript/lib/typescript.js:66593:20)
    at getTypeOfDottedName (/Users/sahindeniz/projects/2022.05.08-insider/skeleton-design-bundle/node_modules/typescript/lib/typescript.js:66597:26)
    at getTypeOfDottedName (/Users/sahindeniz/projects/2022.05.08-insider/skeleton-design-bundle/node_modules/typescript/lib/typescript.js:66597:26)
    at getEffectsSignature (/Users/sahindeniz/projects/2022.05.08-insider/skeleton-design-bundle/node_modules/typescript/lib/typescript.js:66624:22)
    at getTypeAtFlowCall (/Users/sahindeniz/projects/2022.05.08-insider/skeleton-design-bundle/node_modules/typescript/lib/typescript.js:66977:27)
    at getTypeAtFlowNode (/Users/sahindeniz/projects/2022.05.08-insider/skeleton-design-bundle/node_modules/typescript/lib/typescript.js:66863:20)
    at getFlowTypeOfReference (/Users/sahindeniz/projects/2022.05.08-insider/skeleton-design-bundle/node_modules/typescript/lib/typescript.js:66820:47)
    at checkIdentifier (/Users/sahindeniz/projects/2022.05.08-insider/skeleton-design-bundle/node_modules/typescript/lib/typescript.js:68085:24)
"dependencies": {
    "@ckpack/vue-color": "1.4.1",
    "@ctrl/tinycolor": "3.6.0",
    "@egjs/agent": "2.4.3",
    "@floating-ui/dom": "1.2.6",
    "@floating-ui/vue": "0.2.1",
    "@sentry/browser": "6.19.7",
    "@sentry/integrations": "6.19.7",
    "@sentry/tracing": "6.19.7",
    "@sentry/vue": "6.19.7",
    "@vueuse/components": "10.1.0",
    "@vueuse/core": "10.1.0",
    "codemirror": "5.65.9",
    "codemirror-editor-vue3": "2.1.7",
    "fuzzysort": "2.0.4",
    "jshint": "2.13.5",
    "modern-normalize": "1.1.0",
    "moveable": "0.37.1",
    "pinia": "2.0.35",
    "react-moveable": "0.40.0",
    "vue": "3.2.47",
    "vue3-runtime-template": "1.0.2",
    "vuedraggable": "4.1.0"
  },
  "devDependencies": {
    "@cspell/eslint-plugin": "6.19.2",
    "@esbuild-plugins/node-globals-polyfill": "0.2.3",
    "@esbuild-plugins/node-modules-polyfill": "0.2.2",
    "@fastify/static": "6.10.1",
    "@histoire/plugin-vue": "0.16.1",
    "@playwright/experimental-ct-vue": "1.32.3",
    "@playwright/test": "1.32.3",
    "@rushstack/eslint-patch": "1.2.0",
    "@types/codemirror": "5.60.7",
    "@types/cors": "2.8.13",
    "@types/debug": "^4.1.7",
    "@types/eslint": "8.37.0",
    "@types/etag": "^1.8.1",
    "@types/fs-extra": "^11.0.1",
    "@types/jshint": "2.12.1",
    "@types/node": "18.16.0",
    "@types/svgo": "2.6.4",
    "@typescript-eslint/eslint-plugin": "5.59.0",
    "@vitejs/plugin-vue": "4.1.0",
    "@vitejs/plugin-vue-jsx": "3.0.1",
    "@vue/eslint-config-typescript": "11.0.2",
    "@vue/tsconfig": "0.3.1",
    "cors": "2.8.5",
    "debug": "4.3.4",
    "esbuild": "0.17.18",
    "eslint": "8.39.0",
    "eslint-config-airbnb-base": "15.0.0",
    "eslint-config-airbnb-typescript": "17.0.0",
    "eslint-import-resolver-alias": "1.1.2",
    "eslint-plugin-import": "2.27.5",
    "eslint-plugin-jsdoc": "43.0.7",
    "eslint-plugin-vue": "9.11.0",
    "eslint-plugin-vue-scoped-css": "2.4.0",
    "etag": "1.8.1",
    "fastify": "4.15.0",
    "fs-extra": "11.1.1",
    "histoire": "0.16.1",
    "nodemon": "2.0.22",
    "pathe": "1.1.0",
    "rollup": "3.21.0",
    "rollup-plugin-visualizer": "5.9.0",
    "sass": "1.62.0",
    "svg-baker": "1.7.0",
    "svgo": "3.0.2",
    "ts-node": "10.9.1",
    "typescript": "5.0.4",
    "utility-types": "3.10.0",
    "vite": "4.3.1",
    "vite-plugin-checker": "^0.5.6",
    "vite-svg-loader": "4.0.0",
    "vue-eslint-parser": "9.1.1",
    "vue-tsc": "1.4.4"
johnsoncodehk commented 1 year ago

This doesn't look like a vue-tsc issue, there might be a recursive type in your project, we can't investigate it without a repro case.

seahindeniz commented 1 year ago

Yeah, I'll try to create one

adoin commented 1 year ago

Did you find the issue type? I have the same error but can not find which type causing recursive.

seahindeniz commented 1 year ago

It was an expensive search, but I have tracked the issue down by adding folder paths to include field in tsconfig file. When I bump into the folder, I have narrowed my folder scope down to the file which had this issue. For me, it was the following code, line 90 image

I have referenced the type of the Pinia store in the function declared outside the store, which led to the issue

adoin commented 1 year ago

The way you digging this issue do really inspire me. Thank you, now I think I can fix it after few days later.

adoin commented 1 year ago

It was an expensive search, but I have tracked the issue down by adding folder paths to include field in tsconfig file. When I bump into the folder, I have narrowed my folder scope down to the file which had this issue. For me, it was the following code, line 90 image

I have referenced the type of the Pinia store in the function declared outside the store, which led to the issue

This crash happend between two package my projects using. Out of my control now... Do you know which style of type will cause this issue?

seahindeniz commented 1 year ago

At the moment, I don't know. My only solution was removing the type for good. I'll try to create a repo with a minimal repro case so that it can be debugged. Maybe you could do the same so it could be a different test case to this issue. How's that sound?

adoin commented 1 year ago

At the moment, I don't know. My only solution was removing the type for good. I'll try to create a repo with a minimal repro case so that it can be debugged. Maybe you could do the same so it could be a different test case to this issue. How's that sound?

My case is repro package vxe-table has a entry to make some template as global slots. I make some ant design vue component with that. This crash happend between those two package. It seem no solution for now.

seahindeniz commented 1 year ago

@johnsoncodehk do you think adoin's repro case would suffice for investigating the issue? I'll also provide another one for the Pinia related issue

johnsoncodehk commented 5 months ago

Sorry we currently don't have enough energy to focus on issues unrelated to this repo. For related type issues, please raise it in the #language-tools or #typescript channel of the Vue Discord server, thanks.

mityaua commented 3 months ago

At the moment, I don't know. My only solution was removing the type for good. I'll try to create a repo with a minimal repro case so that it can be debugged. Maybe you could do the same so it could be a different test case to this issue. How's that sound?

My case is repro package vxe-table has a entry to make some template as global slots. I make some ant design vue component with that. This crash happend between those two package. It seem no solution for now.

Did you find solution? Cuz I have same problem

 vue-tsc --noEmit -p tsconfig.vitest.json --composite false

...\node_modules\vue-tsc\index.js:39
            throw err;
            ^

RangeError: Maximum call stack size exceeded
    at getApparentTypeOfContextualType ...\node_modules\typescript\lib\tsc.js:71160:43)
    at getContextualTypeForObjectLiteralElement ...\node_modules\typescript\lib\tsc.js:70953:18)
    at getContextualType ...\node_modules\typescript\lib\tsc.js:71242:16)
    at pushCachedContextualType ...\node_modules\typescript\lib\tsc.js:71291:7)
    at checkObjectLiteral ...\node_modules\typescript\lib\tsc.js:71822:5)
    at checkExpressionWorker ...\node_modules\typescript\lib\tsc.js:78504:16)
    at checkExpression ...\node_modules\typescript\lib\tsc.js:78426:32)
    at checkExpressionForMutableLocation ...\node_modules\typescript\lib\tsc.js:78185:18)
    at checkPropertyAssignment ...\node_modules\typescript\lib\tsc.js:78201:12)
    at checkObjectLiteral ...\node_modules\typescript\lib\tsc.js:71849:71)

Node.js v20.16.0