microsoft / microsoft/TypeScript
Automatic Brace Insertion (ABI) is undesirable
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Go
- Star
- 111k
- Fork
- 14.4k
- Merge trung bình
- 1 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 117
Mô tả
TypeScript Version: 3.7-beta
Search Terms: automatic brace insertion ABI syntax error
Code:
function a() {
"Automatic Brace Insertion! (ABI)";
Expected behavior:
The input is syntactically invalid, so emit should fail regardless of the state of noEmitOnError. Other forms of un-parsable input already do this, e.g. function a(
Actual behavior:
A closing brace is inserted in the emitted JS code.
function a() {
"Automatic Brace Insertion! (ABI)";
}
This means that users who are not using noEmitOnError are silently having invalid code transformed into valid code. I can confirm this actually happened to someone shipping something to production.
Playground Link: ABI Playground Link
Related Issues: https://github.com/microsoft/TypeScript/issues/34870 , https://github.com/microsoft/TypeScript/issues/34871 , Lazy Twitter report
I would suggest this bug deserves to be fixed based on Design Goal 7 (Preserve runtime behavior of all JavaScript code) and Design Non-Goal 7 (Introduce behaviour that is likely to surprise users).
Tagline: If the braces don't fit, you must not emit.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với ABI Playground Link và đầu vào TypeScript tối thiểu được hiển thị trong issue, sau đó so sánh hành vi emit của nó với ví dụ hàm chưa kết thúc được liên kết. Theo dõi cách compiler xử lý đầu vào không đúng định dạng này và xác minh rằng emit không thêm dấu ngoặc nhọn đóng cũng như không tạo ra JavaScript có thể chạy được.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- typescript
- Lĩnh vực
- compilers
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100