microsoft / microsoft/TypeScript
[Breaking Change] Typescript 3.7 converts reference paths to tsconfig specified paths breaking multi-project compiles.
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
Typescript is replacing part of a relative path with one of the paths specified in tsconfig's path section. This is breaking the projects that rely on this file as they cannot resolve the path.
TypeScript Version: 3.7
Visual Studio Version: Community 2017
Search Terms:
Typescirpt paths tsconfig reference paths alias.
Code
In the client project at folder\folder\file.ts
/// <reference path="../../External/Knockout/index.d.ts" />
Becomes (in ClientDeclarations) folder\folder\file.d.ts:
/// <reference types="@Client/external/knockout/index" />
My tsconfig file (folder names with sensitive information are replaced with ***)
{
"compileOnSave": true,
"compilerOptions": {
"module": "amd",
"target": "es6",
"lib": [ "es6", "dom" ],
"sourceMap": true,
"strict": true,
"build": true,
"declaration": true,
"declarationDir": "../ClientDeclarations",
"baseUrl": "./",
"paths": {
"@Common/*": [ "../Common/*" ],
"@Server/*": [ "../ServerDeclarations/*" ],
"@Client/*": [ "./*"]
}
},
"include": [
"./*",
"./External/***/koco.ts",
"./External/***/kocss.ts",
"./External/***/kopath.ts"
],
"exclude": [
"node_modules"
],
"references": [
{ "path": "../Common" }
]
}
Expected behavior:
The path should not be transformed during output.
Actual behavior:
The path is transformed to include an @Client reference, which my dependant projects can't resolve. This did not happen in tsc 3.4.
Additionally all of the casing is altered - meaning that this path would not resolve on linux machines.
Related Issues:
I haven't been able to find any - probably because what I'm trying to look for is called a "path" (in tsconfig) which is a highly overloaded term, making searching for anything related to it almost impossible. It would be nice to call it something like a "path alias" so that searching for related issues was easier.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
示されている tsconfig のパス、プロジェクト参照、相対的な /// 参照パスを使って tsc 3.7 で宣言出力を再現し、その後 tsc 3.4 と比較します。declaration emit が参照と大文字・小文字をどのように変換するかを追跡します。依存プロジェクトで、誤った @Client エイリアスや大文字・小文字の変更なしに相対参照を解決できる状態になれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- build-system, compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100