microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.71k stars 29.08k forks source link

TS Server fatal error: Debug Failure. False expression: Type assertions should never be parsed outside of TS; they should either be comparisons or JSX. #174520

Closed CNLeonSHAN closed 1 year ago

CNLeonSHAN commented 1 year ago

Type: Bug

❗️❗️❗️ Please fill in the sections below to help us diagnose the issue ❗️❗️❗️

TypeScript Version: 5.0.0-dev.20230214

Steps to reproduce crash

1. 2. 3.

Global TypeScript Server Plugins

❗️ Please test with extensions disabled. Extensions are the root cause of most TypeScript server crashes

TS Server Log

❗️ Server logging disabled. To help us fix crashes like this, please enable logging by setting:

"typescript.tsserver.log": "verbose"

After enabling this setting, future crash reports will include the server log.

TS Server Error Stack

Server: semantic

Error: Debug Failure. False expression: Type assertions should never be parsed outside of TS; they should either be comparisons or JSX.
    at parseTypeAssertion (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:33923:11)
    at parseSimpleUnaryExpression (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:33552:16)
    at parseUnaryExpressionOrHigher (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:33520:35)
    at parseBinaryExpressionOrHigher (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:33438:25)
    at parseAssignmentExpressionOrHigher (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:33111:18)
    at parseExpression (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:33077:16)
    at doOutsideOfContext (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:30772:12)
    at allowInAnd (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:30793:12)
    at parseExpressionOrLabeledStatement (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:34593:24)
    at parseStatement (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:34825:12)
    at parseListElement (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:31544:12)
    at parseList (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:31529:19)
    at parseSourceFileWorker (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:30588:24)
    at Object.parseSourceFile (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:30421:20)
    at createSourceFile (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:30282:21)
    at createLanguageServiceSourceFile (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:134950:22)
    at acquireOrUpdateDocument (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:131872:26)
    at Object.acquireDocumentWithKey (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:131797:12)
    at getOrCreateSourceFileByPath (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:135275:31)
    at Object.getOrCreateSourceFile (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:135255:14)
    at /Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:135187:42
    at Object.getSourceFileWithCache [as getSourceFile] (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:116954:24)
    at findSourceFileWorker (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:119286:23)
    at findSourceFile (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:119206:20)
    at /Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:119155:22
    at getSourceFileFromReferenceWorker (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:119124:26)
    at processSourceFile (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:119153:5)
    at processRootFile (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:118949:5)
    at /Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:117734:41
    at forEach (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:2308:22)
    at createProgram (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:117734:5)
    at synchronizeHostData (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:135211:15)
    at Proxy.getProgram (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:135283:5)
    at ConfiguredProject2.updateGraphWorker (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:171842:41)
    at ConfiguredProject2.updateGraph (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:171779:32)
    at ConfiguredProject2.updateGraph (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:172961:24)
    at _ProjectService.createLoadAndUpdateConfiguredProject (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:174568:13)
    at _ProjectService.assignProjectToOpenedScriptInfo (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:175659:26)
    at /Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:175939:64
    at flatMap (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:2556:17)
    at _ProjectService.applyChangesInOpenFiles (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:175939:24)
    at updateOpen (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:177084:29)
    at /Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:179651:69
    at IpcIOSession.executeWithRequestId (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:179643:14)
    at IpcIOSession.executeCommand (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:179651:29)
    at IpcIOSession.onMessage (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:179693:51)
    at process.<anonymous> (/Users/chaozhang/.vscode/extensions/ms-vscode.vscode-typescript-next-5.0.202302140/node_modules/typescript/lib/tsserver.js:181261:14)
    at process.emit (node:events:526:28)
    at emit (node:internal/child_process:938:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:84:21)

VS Code version: Code 1.75.0 (Universal) (e2816fe719a4026ffa1ee0189dc89bdfdbafb164, 2023-02-01T15:24:42.903Z) OS version: Darwin x64 21.6.0 Modes: Sandboxed: No

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz (8 x 2500)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|9, 6, 5| |Memory (System)|16.00GB (0.09GB free)| |Process Argv|--crash-reporter-id 00a0dc8a-e3f3-4e78-9647-62615df9416d| |Screen Reader|no| |VM|0%|
Extensions (49) Extension|Author (truncated)|Version ---|---|--- codesnap|adp|1.3.4 path-intellisense|chr|2.8.4 vscode-eslint|dba|2.4.0 gitlens|eam|13.2.0 prettier-vscode|esb|9.10.4 auto-close-tag|for|0.5.14 auto-rename-tag|for|0.1.10 code-runner|for|0.12.0 gc-excelviewer|Gra|4.2.56 todo-tree|Gru|0.0.224 naive-ui-snippets|Jim|0.0.3 element-plus-snippets|jin|0.1.97 intellij-idea-keybindings|k--|1.5.5 favorites|kdc|2.4.5 element-plus-plus|mic|2.0.1 dotenv|mik|1.0.1 vue-volar-extention-pack|Mis|1.1.6 vscode-language-pack-zh-hans|MS-|1.75.2023021509 isort|ms-|2022.8.0 python|ms-|2023.2.0 vscode-pylance|ms-|2023.2.30 jupyter|ms-|2023.1.2010391206 jupyter-keymap|ms-|1.0.0 jupyter-renderers|ms-|1.0.14 vscode-jupyter-cell-tags|ms-|0.1.6 vscode-jupyter-slideshow|ms-|0.1.5 vscode-typescript-next|ms-|5.0.202302150 sftp|Nat|1.16.2 color-highlight|nau|2.5.0 autodocstring|njp|0.6.1 tsimporter|pmn|2.0.1 vscode-data-preview|Ran|2.3.0 LiveServer|rit|5.7.9 vue-vscode-snippets|sdr|3.1.1 code-settings-sync|Sha|3.4.3 vscode-scss-formatter|sib|2.4.5 autoimport|ste|1.5.4 code-spell-checker|str|2.16.0 sass-indented|syl|1.8.24 cloudbase-toolkit|ten|0.3.1 tencent-cloud-vscode-toolkit|ten|2.0.17 volar|Vue|1.1.0 vscode-typescript-vue-plugin|Vue|1.1.0 vue|Wsc|1.0.26 JavaScriptSnippets|xab|1.8.0 tree-generator|xbo|1.0.3 markdown-pdf|yza|1.4.4 material-theme|zhu|3.15.6 html-css-class-completion|Zig|1.20.0 (3 theme extensions excluded)
A/B Experiments ``` vsliv368:30146709 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vslsvsres303:30308271 pythonvspyl392:30443607 vserr242:30382549 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263cf:30335440 pythondataviewer:30285071 vscod805:30301674 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 cmake_vspar411:30581797 vsaa593:30376534 pythonvs932:30410667 cppdebug:30492333 vscaac:30438847 vsclangdf:30486550 c4g48928:30535728 dsvsc012cf:30540253 azure-dev_surveyone:30548225 vscccc:30610679 pyindex848:30662994 nodejswelcome1cf:30587006 3biah626:30602489 pyind779:30662992 f6dab269:30613381 pythonsymbol12:30657548 ```
vscodenpa commented 1 year ago

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.75.1. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

vscodenpa commented 1 year ago

This issue is caused by an extension, please file it with the repository (or contact) the extension has linked in its overview in VS Code or the marketplace for VS Code. See also our issue reporting guidelines. If you don't know which extension is causing the problem, you can run Help: Start extension bisect from the command palette (F1) to help identify the problem extension.

Happy Coding!