microsoft / microsoft/TypeScript
Detect Typescript in Javascript editors opened and inform developer, that he is writing different syntax and it will silently fail (probably)
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ả
It would be super helpful to have something like:
Warning: TypeScript syntax detected in .jsx file.
Would you like to:
[ ] Rename to .tsx
[ ] Remove TypeScript syntax
[ ] Ignore warning
This kind of UX improvement could save developers (especially those transitioning between JS and TS projects) a lot of time and frustration. It seems like a relatively straightforward detection that could help a lot of people!
VSCode already does similar helpful suggestions for other cases (like offering to create files that don't exist when you import them), so this would fit right in with that philosophy.
What it would solve?
It's the classic .jsx vs .tsx gotcha! 😄
This is such a common issue that even experienced developers run into it regularly. The file extension makes all the difference because:
.jsxfiles are treated as regular JavaScript/React files.tsxfiles are treated as TypeScript/React files
So TypeScript typing just "silently fails" to work in .jsx files without any obvious error message about why the types aren't working.
It's one of those "spend an hour debugging only to realize it's a file extension" moments that every developer has experienced!
.CJS->.TS,.JS->.TS,.JSX->.TSX
(Similar functionality could be created for CSS -> SCSS, ... .)
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
Issue không nêu tên tệp, bài kiểm thử hoặc điểm vào nào. Hãy bắt đầu bằng cách xác định nơi triển khai các chẩn đoán của trình soạn thảo hoặc các đề xuất của language service, sau đó xác định cách hoạt động phát hiện cú pháp và các thao tác đổi tên, xóa hoặc bỏ qua sẽ phù hợp; được xem là hoàn thành khi cảnh báo được đề xuất hoạt động với các phần mở rộng được liệt kê mà không làm gián đoạn JavaScript hợp lệ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript, typescript
- Lĩnh vực
- developer-experience, tooling
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 30/100