microsoft / microsoft/TypeScript

Bloomberg feedback for 5.9

オープン
#62,156 コメント 1 件 リアクション 7 件 担当者 0 名 GitHub で見る

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

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

説明

Comment

We evaluated the 5.9 RC releases and 5.9 is a low impact release for us.

# Change Affects Release notes Packages affected PR / Issue
1 Class expressions with private fields produce invalid .d.ts output Declaration Emit No <1% #62153
2 Promise.all over constant tuples no longer infers tuple Type Checking No <1% #62071
3 JavaScript emit removes parentheses around ?? in conditional expressions Emit No <1%
4 Better detection of always-true errors in ?? expressions Type Checking No <1%

Class expressions with private fields produce invalid .d.ts output

With TypeScript 5.9, the following code:

export const ClassExpression = class {
    #context = 0
};

Produces invalid declaration output:

export declare const ClassExpression: {
    new (): {
        #context: number;
    };
};

5.8 output was also incorrect but at least syntactically valid:

export declare const ClassExpression: {
    new (): {
        "__#1@#context": number;
    };
};

❗This seems like a major regression, since emitted declarations are now invalid.
Tracked in #62153

Promise.all over array literal no longer infers a tuple

This issue is easier to reproduce than the linked ticket may suggest. It affects any use of Promise.all in the return position of a .then() that chains from a promise resolving to an array:

const p = Promise.resolve([]).then(() => {
    return Promise.all([0, ""]);
});
const test: Promise<[number, string]> = p; // error

This now fails to infer a tuple and infers Promise<(string | number)[]> instead.
While we can work around this issue by assigning the result of Promise.all to an intermediate variable, this does seem like an unfortunate regression.

Tracked in #62071

JavaScript emit removes parentheses around ?? in conditional expressions

In some cases, parentheses are removed from nullish coalescing expressions in emitted JavaScript. This change seems benign.

(test ?? true) ? A : B

Becomes:

test ?? true ? A : B

Better detection of always-true errors in ?? expressions

We observed two new diagnostics related to always-true ?? expressions.
The improved detection highlighted logic errors that were previously missed.

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

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

はじめの一歩

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

調査の方向性

Issue 内の再現スニペットと、報告された回帰のうち 2 つを追跡しているリンク先のチケット #62153 および #62071 から始めてください。5.8 と 5.9 の宣言または type-checking の挙動を比較し、その後の作業は確認済みの回帰 1 件に絞ってください。報告自体には、ファイル、テスト、または単一の Definition of done は特定されていません。

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

評価

技術スタック
javascript, typescript
領域
compilers
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
15/100

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

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