Repository: TypeScript
Issue: Error: Debug Failure. False expression.
Labels: Needs More Info

# Bug Report

<!--
  Please fill in each section completely. Thank you!
-->

### 🔎 Search Terms
debug failure, false expression, at object.first

<!--
  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.
-->

### 🕗 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 is the behavior in every version I tried, 4.9.5, and I reviewed the FAQ for entries about it
- I was unable to test this on prior versions because I had other issues with prior versions that made me update to a later version

### ⏯ 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-->
**stack trace:**
```bash
/Users/calebpitan/source/work/zendwa/emailing-service/node_modules/typescript/lib/tsc.js:99615
                throw e;
                ^

Error: Debug Failure. False expression.
    at Object.first (/Users/calebpitan/source/work/zendwa/emailing-service/node_modules/typescript/lib/tsc.js:990:18)
    at getSpecifierForModuleSymbol (/Users/calebpitan/source/work/zendwa/emailing-service/node_modules/typescript/lib/tsc.js:45313:36)
    at serializeAsAlias (/Users/calebpitan/source/work/zendwa/emailing-service/node_modules/typescript/lib/tsc.js:46419:107)
    at serializeSymbolWorker (/Users/calebpitan/source/work/zendwa/emailing-service/node_modules/typescript/lib/tsc.js:46084:25)
    at serializeSymbol (/Users/calebpitan/source/work/zendwa/emailing-service/node_modules/typescript/lib/tsc.js:45978:25)
    at /Users/calebpitan/source/work/zendwa/emailing-service/node_modules/typescript/lib/tsc.js:45963:29
    at Map.forEach (<anonymous>)
    at visitSymbolTable (/Users/calebpitan/source/work/zendwa/emailing-service/node_modules/typescript/lib/tsc.js:45962:81)
    at symbolTableToDeclarationStatements (/Users/calebpitan/source/work/zendwa/emailing-service/node_modules/typescript/lib/tsc.js:45847:17)
    at /Users/calebpitan/source/work/zendwa/emailing-service/node_modules/typescript/lib/tsc.js:44127:106

Node.js v18.11.0
```

**source: node_modules/typescript/lib/tsc.js**
```js
ts.firstOrUndefined = firstOrUndefined;
first(array) {
    ts.Debug.assert(array.length !== 0);
    return array[0];
}
ts.first = first;
```

**tsconfig.json:**
```json
{
  "compilerOptions": {
    "module": "ES2020",
    "moduleResolution": "node",
    "allowJs": true,
    "checkJs": false,
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "target": "ES2022",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "rootDir": "./",
    "incremental": true,
    "skipLibCheck": true,
    "strict": true,
    "strictNullChecks": true,
    "noImplicitAny": true,
    "noImplicitThis": true,
    "strictBindCallApply": true,
    "alwaysStrict": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "paths": {
      "@/shared/*": ["backend-services-shared/src/*"], // contains .js files
      "@/utils/*": ["src/utils/*"],
      "@/modules/*": ["src/modules/*"]
    }
  },
  "exclude": ["node_modules", "test", "dist"]
}
```

### 🙁 Actual behavior

<!-- What happened, and why it was wrong -->

Error happens when I turn on `allowJs`

### 🙂 Expected behavior

`allowJs` shouldn't crash build process and should include the js files from the source in the build output 😔
<!-- What you expected to happen instead, and why -->