Repository: TypeScript
Issue: should be able to run typescript under `--frozen-intrinsics`
Labels: Suggestion,Experience Enhancement

# Bug Report

<!--
  Please fill in each section completely. Thank you!
-->

### 🔎 Search Terms

<!--
  What search terms did you use when trying to find an existing bug report?
  List them here so people in the future can find this one more easily.
-->

- `--frozen-intrinsics`
- `Error.stackTraceLimit`
- prototype protection

### 🕗 Version & Regression Information

<!-- When did you start seeing this bug occur?

"Bugs" that have existed in TS for a long time are very likely to be FAQs; refer to
  https://github.com/Microsoft/TypeScript/wiki/FAQ#common-bugs-that-arent-bugs

If possible, please try testing the nightly version of TS to see if it's already been fixed.
For npm: `typescript@next`
This is also the 'Nightly' version in the playground: http://www.typescriptlang.org/play/?ts=Nightly

Note: The TypeScript Playground can be used to try older versions of TypeScript.

Please keep and fill in the line that best applies:
-->
- This is a crash
- This changed between versions ______ and _______
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
- I was unable to test this on prior versions because _______

### ⏯ Playground Link

<!--
  A link to a TypeScript Playground "Share" link which shows this behavior

  The TypeScript Workbench can be used for more complex setups, try
  https://www.typescriptlang.org/dev/bug-workbench/

  As a last resort, you can link to a repo, but these will be slower for us to investigate.
-->
[Playground link with relevant code](https://www.typescriptlang.org/play?#code/PTAEFkE9QYwewCYFNQHM5IM6gBZIE5JA)

### 💻 Code

<!-- Please post the relevant code sample here as well-->
```ts
import ts from 'typescript'
console.log(ts.sys.fileExists("reproduce.mjs"))
```

### 🙁 Actual behavior

<!-- What happened, and why it was wrong -->

```txt
$ node --frozen-intrinsics reproduce.mjs 
(node:239937) ExperimentalWarning: The --frozen-intrinsics flag is experimental
(Use `node --trace-warnings ...` to show where the warning was created)
/path/to/node_modules/typescript/lib/typescript.js:6530
            Error.stackTraceLimit = 0;
                                  ^

TypeError <Object <Object <[Object: null prototype] {}>>>: Cannot assign to read only property 'stackTraceLimit' of function 'function Error() { [native code] }'
    at fileSystemEntryExists (/path/to/node_modules/typescript/lib/typescript.js:6530:35)
    at fileExists (/path/to/node_modules/typescript/lib/typescript.js:6551:20)
    at isFileSystemCaseSensitive (/path/to/node_modules/typescript/lib/typescript.js:6397:21)
    at getNodeSystem (/path/to/node_modules/typescript/lib/typescript.js:6189:45)
    at /path/to/node_modules/typescript/lib/typescript.js:6603:18
    at src/compiler/sys.ts (/path/to/node_modules/typescript/lib/typescript.js:6609:9)
    at __init (/path/to/node_modules/typescript/lib/typescript.js:22:58)
    at src/compiler/_namespaces/ts.ts (/path/to/node_modules/typescript/lib/typescript.js:125073:7)
    at __init (/path/to/node_modules/typescript/lib/typescript.js:22:58)
    at src/typescript/_namespaces/ts.ts (/path/to/node_modules/typescript/lib/typescript.js:169775:7)

Node.js v18.15.0
```

### 🙂 Expected behavior

<!-- What you expected to happen instead, and why -->

```txt
$ node reproduce.mjs 
true
$ node --frozen-intrinsics reproduce.mjs 
true
```