microsoft / microsoft/TypeScript

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

オープン 初心者向け
#41,952 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る

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

Docs
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

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

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

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

はじめの一歩

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

調査の方向性

Issue にリンクされているモジュール解決の handbook ページから始め、現在の説明を .js と .jsx の例に対する traceResolution の出力と比較してください。どの拡張子が取り除かれ、どの lookup が続いて行われるのかを記録し、そのページがコンパイラーの動作を変更せずに両方の質問へ回答していることを確認してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
documentation
issue の種類
ドキュメント
難易度
2/5
見積もり時間
1〜3時間
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
68/100

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

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