microsoft / microsoft/TypeScript

Project References and noEmitOnError

オープン
#32,651 コメント 16 件 リアクション 16 件 担当者 0 名 GitHub で見る

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

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

説明

Search Terms

project references
noEmitOnError
build flag

fast development feedback

babel/preset-typescript
babel/plugin-transform-typescript

Suggestion

Project with error in it should not be marked as up to date.

Build flag should respect noEmitOnError preference as set by user in .tsconfig

I understand that current works-as-expected is that the build flag sets this to true. This is a feature request with suggestions on how to change that design.

Per Typescript Handbook - Project References - Caveats

if one of your out-of-date dependencies had a new error, you’d only see it once because a subsequent build would skip building the now up-to-date project

Suggestion: Project with error in it should not be marked as up to date

  • Can this assumption be changed?
  • Maybe .tsbuildinfo file can be used to store this state?
  • Incremental compilation works well with single projects and with watch flag: maybe the same mechanism for detecting up-to-date can be used for multiple project builds?

Use Cases

Fast development feedback. In my case, I'm running both tsc -wb and jest --watch side by side. I want my test cases to run even if my types aren't perfect.

Right now, I am forced to resolve ALL type errors before I can get any feedback. This makes it difficult to develop iteratively.

Moreover, what is not seen in this issue tracker here: A number of people are now running babel and typescript side by side. One of the reasons could very well be just this. There is no need to run babel for pure transpilation if typescript can emit with errors.

Examples

dev feedback; live test cases; live browser refresh; other use cases

Other people:
https://github.com/microsoft/TypeScript/issues/29851
https://github.com/microsoft/TypeScript/issues/25600#issuecomment-450644121
https://github.com/microsoft/TypeScript/issues/25600#issuecomment-473389927
https://github.com/microsoft/TypeScript/issues/25600#issuecomment-482865289

Workarounds

Meanwhile, we can do this:

  • run tsc --watch directly in the referenced project directory
  • // @ts-ignore OR // @ts-nocheck flags

Checklist

My suggestion meets these guidelines:

  • [x ] This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • [ x] This wouldn't change the runtime behavior of existing JavaScript code
  • [ x] This could be implemented without emitting different JS based on the types of the expressions
  • [ x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • [x ] This feature would agree with the rest of TypeScript's Design Goals.

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

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

はじめの一歩

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

調査の方向性

まず、issue にリンクされている Project References - Caveats セクションと、関連する issue 29851 および 25600 を読みます。project references、noEmitOnError、.tsbuildinfo がどのように連携すべきかを定義し、そのうえで、開発時の高速なフィードバックを維持しながら、エラーのあるプロジェクトが最新として扱われないことを検証します。

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

評価

技術スタック
typescript
領域
build-system, compilers
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

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

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