microsoft / microsoft/TypeScript

Document File name has a '.js' extension - stripping it

Đang mở Phù hợp với người mới
#41,952 1 bình luận 1 reaction 0 người được giao Xem trên GitHub

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

Docs
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ả

TypeScript Version: 4.2.0-dev.20201211

Search Terms: typescript File name has a '.js' extension - stripping it

Code

https://github.com/sguillia/ts-repro-III

other.ts

import * as index from "./index.js"

index.ts

export { }

Compile with:

tsc other.ts --traceResolution

Expected behavior:

Does not compile?

Actual behavior:

$ tsc other.ts --traceResolution
...
File name '/path/to/ts-repro-III/index.js' has a '.js' extension - stripping it.
...

This document is very good:
https://www.typescriptlang.org/docs/handbook/module-resolution.html

But it doesn't talk about resolution of modules with their extensions.

The actual behavior is fine but I did not manage to find its documentation

Same issue for jsx

$ tsc other.ts --traceResolution
...
File name '/path/to/ts-repro-III/index.jsx' has a '.jsx' extension - stripping it.
...

Would it be possible to document

  • which extension are trimmed?
  • what look-ups are performed based on the file name with extension stripped?

Playground Link: https://github.com/sguillia/ts-repro-III

Related Issues: no

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.

Hướng nghiên cứu

Bắt đầu với trang handbook về module resolution được liên kết trong issue và so sánh phần giải thích hiện tại của trang với đầu ra traceResolution cho các ví dụ .js và .jsx. Ghi lại những phần mở rộng nào bị loại bỏ và những lần lookup nào được thực hiện tiếp theo, sau đó xác minh rằng trang trả lời cả hai câu hỏi mà không thay đổi hành vi của compiler.

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
documentation
Loại issue
Tài liệu
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
68/100

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.