microsoft / microsoft/TypeScript

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

Đang mở
#62,072 1 bình luận 1 reaction 1 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Bug Domain: API: Transforms Help Wanted
Ngôn ngữ chính
Go
Star
111k
Fork
14.3k
Merge trung bình
2 ngày 4 giờ
Pull request đã merge (30 ngày)
132

Mô tả

### 🔎 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_

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.