Repository: TypeScript
Issue: TS Server fatal error:  Maximum call stack size exceeded
Labels: Bug,Fix Available,Rescheduled

Type: <b>Bug</b>

Hope I've provided enough information below. The bug manifests as a notification with the text:

> The JS/TS language service immediately crashed 5 times. The service will not be restarted.

Observed in VS Code versions:

- Version: 1.72.1 (Universal)
- Commit: 129500ee4c8ab7263461ffe327268ba56b9f210d
- Date: 2022-10-10T17:25:13.482Z (2 days ago)

And: 

- Version: 1.73.0-insider (Universal)
- Commit: a8108049ab61b970f2ec1839dfb753054e07395e
- Date: 2022-10-13T05:19:29.769Z (6 hrs ago)

Problem persists when `code --disable-extensions` is run on either version.

## Report below was generated from Insiders release

**TypeScript Version:** 4.8.4

**Steps to reproduce crash**
1. Open VS Code
2. Open Folder
3. Open JavaScript file
4. The JS/TS language services crashes

**TS Server Log**

https://gist.github.com/shuckster/f56477f7b3fdf1686214c2c8c8309c50

Personal/Company info redacted, but codebase is a mix of both JavaScript and Flow-typed JavaScript.

**TS Server Error Stack**
Server: `semantic`
```
RangeError: Maximum call stack size exceeded
    at Object.scanJsxToken (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:12041:30)
    at scanJsxText (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:32328:43)
    at parseJsxOpeningOrSelfClosingElementOrOpeningFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35663:17)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35527:27)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
    at parseJsxChild (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35617:28)
    at parseJsxChildren (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35628:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:35530:32)
```

VS Code version: Code - Insiders 1.73.0-insider (Universal) (a8108049ab61b970f2ec1839dfb753054e07395e, 2022-10-13T05:19:29.769Z)
OS version: Darwin arm64 21.6.0
Modes:
Sandboxed: Yes

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Apple M1 Pro (10 x 24)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: disabled_off<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>metal: disabled_off<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>skia_renderer: enabled_on<br>video_decode: enabled<br>video_encode: enabled<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: disabled_off|
|Load (avg)|8, 7, 5|
|Memory (System)|32.00GB (6.14GB free)|
|Process Argv||
|Screen Reader|no|
|VM|0%|
</details>Extensions: none<details>
<summary>A/B Experiments</summary>

```
vsliv695:30137379
vsins829:30139715
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30422396
pythontb:30258533
vsc_aacf:30263846
pythonptprofiler:30281269
vshan820:30294714
pythondataviewer:30285072
vscod805cf:30301675
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593:30376534
pythonvs932:30404738
cppdebug:30492333
vsclangdf:30492506
c4g48928:30535728
dsvsc012cf:30540253
pylantcb52:30568093
vscccc:30564267
pyindex848:30577858
nodejswelcome1:30587009

```

</details>

<!-- generated by issue reporter -->