microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.41k stars 29.33k 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. #174437

Closed xuemiyang closed 1 year ago

xuemiyang 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 (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:33923:11)
    at parseSimpleUnaryExpression (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:33552:16)
    at parseUnaryExpressionOrHigher (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:33520:35)
    at parseBinaryExpressionOrHigher (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:33438:25)
    at parseAssignmentExpressionOrHigher (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:33111:18)
    at parseExpression (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:33077:16)
    at doOutsideOfContext (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:30772:12)
    at allowInAnd (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:30793:12)
    at parseExpressionOrLabeledStatement (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:34593:24)
    at parseStatement (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:34825:12)
    at parseListElement (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:31544:12)
    at parseList (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:31529:19)
    at parseSourceFileWorker (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:30588:24)
    at Object.parseSourceFile (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:30421:20)
    at createSourceFile (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:30282:21)
    at createLanguageServiceSourceFile (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:134950:22)
    at acquireOrUpdateDocument (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:131872:26)
    at Object.acquireDocumentWithKey (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:131797:12)
    at getOrCreateSourceFileByPath (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:135275:31)
    at Object.getOrCreateSourceFile (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:135255:14)
    at c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:135187:42
    at Object.getSourceFileWithCache [as getSourceFile] (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:116954:24)
    at findSourceFileWorker (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:119286:23)
    at findSourceFile (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:119206:20)
    at c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:119155:22
    at getSourceFileFromReferenceWorker (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:119124:26)
    at processSourceFile (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:119153:5)
    at processRootFile (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:118949:5)
    at c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:117734:41
    at forEach (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:2308:22)
    at createProgram (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:117734:5)
    at synchronizeHostData (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:135211:15)
    at Object.getProgram (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:135283:5)
    at ConfiguredProject2.updateGraphWorker (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:171842:41)
    at ConfiguredProject2.updateGraph (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:171779:32)
    at ConfiguredProject2.updateGraph (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:172961:24)
    at _ProjectService.createLoadAndUpdateConfiguredProject (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:174568:13)
    at _ProjectService.assignProjectToOpenedScriptInfo (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:175659:26)
    at c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:175939:64
    at flatMap (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:2556:17)
    at _ProjectService.applyChangesInOpenFiles (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:175939:24)
    at updateOpen (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:177084:29)
    at c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:179651:69
    at IpcIOSession.executeWithRequestId (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:179643:14)
    at IpcIOSession.executeCommand (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:179651:29)
    at IpcIOSession.onMessage (c:\Users\xuemiyang\.vscode\extensions\ms-vscode.vscode-typescript-next-5.0.202302140\node_modules\typescript\lib\tsserver.js:179693:51)
    at process.<anonymous> (c:\Users\xuemiyang\.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.1 (441438abd1ac652551dbe4d408dfcec8a499b8bf, 2023-02-08T21:32:34.589Z) OS version: Windows_NT x64 10.0.17134 Modes: Sandboxed: No

System Info |Item|Value| |---|---| |CPUs|Intel(R) Pentium(R) CPU G4560 @ 3.50GHz (4 x 3504)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
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)|undefined| |Memory (System)|15.90GB (9.70GB free)| |Process Argv|--crash-reporter-id 9c2d8d8e-d258-4bd6-871a-4f78268ea2a9| |Screen Reader|no| |VM|0%|
Extensions (46) Extension|Author (truncated)|Version ---|---|--- doxdocgen|csc|1.4.0 vscode-eslint|dba|2.4.0 go|gol|0.37.1 vscode-drawio|hed|1.6.6 better-cpp-syntax|jef|1.17.2 svg|joc|1.5.0 cmake-language-support-vscode|jos|0.0.9 vscode-docker|ms-|1.23.3 vscode-language-pack-zh-hans|MS-|1.75.2023020809 vscode-dotnet-runtime|ms-|1.6.0 remote-containers|ms-|0.275.1 remote-ssh|ms-|0.96.0 remote-ssh-edit|ms-|0.84.0 remote-wsl|ms-|0.75.2 cmake-tools|ms-|1.13.45 cpptools|ms-|1.14.3 cpptools-extension-pack|ms-|1.3.0 makefile-tools|ms-|0.6.0 remote-explorer|ms-|0.2.0 vscode-typescript-next|ms-|5.0.202302140 nocalhost|noc|0.6.19 erlang|pgo|0.8.6 fabric8-analytics|red|0.3.6 java|red|1.14.0 vscode-xml|red|0.24.0 vscode-yaml|red|1.11.0 iconfont-preview|stx|0.0.4 vscode-stylelint|sty|1.2.4 cmake|twx|0.0.17 intellicode-api-usage-examples|Vis|0.2.7 vscodeintellicode|Vis|1.2.30 vscode-boot-dev-pack|vmw|0.2.1 vscode-spring-boot|vmw|1.44.0 vscode-java-debug|vsc|0.48.0 vscode-java-dependency|vsc|0.21.1 vscode-java-pack|vsc|0.25.2023021400 vscode-java-test|vsc|0.37.1 vscode-lombok|vsc|1.1.0 vscode-maven|vsc|0.40.4 vscode-spring-boot-dashboard|vsc|0.10.1 vscode-spring-initializr|vsc|0.11.2 volar|Vue|1.0.24 vscode-typescript-vue-plugin|Vue|1.0.25 jar-viewer|wma|1.2.0 erlang-otp|yuc|0.2.4 vscode-proto3|zxh|0.5.5 (1 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 vscorecescf:30445987 pythondataviewer:30285071 vscod805:30301674 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 cmake_vspar411:30581797 vsaa593:30376534 pythonvs932:30410667 cppdebug:30492333 vsclangdc:30486549 c4g48928:30535728 dsvsc012:30540252 azure-dev_surveyone:30548225 vsccc:30610678 pyindex848:30662994 nodejswelcome1cf:30587006 3biah626:30602489 pyind779cf:30662993 89544117:30613380 pythonsymbol12cf:30657549 2i9eh265:30646982 vscodedisable:30660115 ```
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!