microsoft / microsoft/TypeScript

"await x as any" - Node PartiallyEmittedExpression did not pass test 'isLeftHandSideExpression' assert triggered

オープン
#62,072 コメント 1 件 リアクション 1 件 担当者 1 名 GitHub で見る

まだ誰も着手していません。

Bug Domain: API: Transforms Help Wanted
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

### 🔎 Search Terms

"PartiallyEmittedExpression", "isLeftHandSideExpression", "NODE_ENV" "NODE_ENV=development"

### 🕗 Version & Regression Information

This is the behavior in every version I tried (4.0, 5.0, and 5.8.3), and I reviewed the FAQ to see if anything related was in there

### ⏯ Playground Link

_No response_

### 💻 Code

```ts
async function test() {
const test = (await null as any)!;
};
```

Executing this code in the Playground will be fine, but the bug can be triggered by running tsc with env var NODE_ENV=development turned on.

### 🙁 Actual behavior

Executing this code in the Playground will be fine, but running this with tsc on the command line with env flag NODE_ENV=development will fail with the following error:

```
Error: Debug Failure. False expression: Unexpected node.
Verbose Debug Information: Node PartiallyEmittedExpression did not pass test 'isLeftHandSideExpression'.
```

We did not realize NODE_ENV=development would affect TypeScript, and start throwing errors on code that normally compiles perfectly fine.

### 🙂 Expected behavior

Either NODE_ENV=development should not affect TypeScript at all, or at least TypeScript shouldn't crash when hitting some debug path? If this behavior is expected then putting an item in the FAQ about ensuring NODE_ENV is not set to development might be sensible.

### Additional information about the issue

_No response_

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。