microsoft / microsoft/TypeScript

OOME/Excessively deep type on upgrade from 4.9.4 to 5.x, introduced in 5.0.0-dev.20230203

オープン
#54,517 コメント 9 件 リアクション 6 件 担当者 1 名 GitHub で見る

@jakebailey がすでに取り組んでいます。

2023年6月20日 から。

Needs Investigation
主要言語
Go
スター
111k
フォーク
14.4k
平均マージ
1日 19時間
マージ済み PR(30日)
117

説明

Bug Report

🔎 Search Terms

tsc 5.x Out of Memory Heap

🕗 Version & Regression Information
  • This is a crash
  • This changed between versions 5.0.0-dev.20230202 and 5.0.0-dev.20230203
⏯ Playground Link

Unavailable, as I'm trying to compile an internal codebase, but I can provide access to our github repo if possible.

💻 Code

The "Type is excessively deep" is being triggered in code that calls this function:

export type LoadedCollaboration = Loaded<Collaboration, "parent">;
export async function getCollaborationMetadata(c: LoadedCollaboration): Promise<CollaborationMetadata> {
  ...
}

Where Loaded is a mapped type (which is available in our open source project):

https://github.com/stephenh/joist-ts/blob/main/packages/orm/src/loadHints.ts#L168

And the Collaboration "parent" key (from our internal project) is a union type with ~20 different types in it:

export type CollaborationParent =
  | ScheduleSubPhase
  | Approval
  ...15 others...
  | ToDo
  | SchedulePhase;
🙁 Actual behavior

In TS 4.9.4, our codebase compiled fine, in about 50 seconds.

I tried upgrading to TS 5.1.3, and the compile now OOMEs, and if given enough RAM, eventually after ~10-15 minutes, fails with a "Type instantiation is excessively deep and possibly infinite" error.

By using the 5.0.0 nightlies published to npm, I was able to bisect that version 5.0.0-dev.20230203 is what introducing the issue, and caused our compile times to jump from ~50 seconds -> 10+ minutes & fail with the type error.

🙂 Expected behavior

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

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

はじめの一歩

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

評価

この issue はまだ評価されていません。

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

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