Add JSX.ElementChildrenAttribute change to TypeScript 5.8 release notes
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 68/100
- issue の種類
- ドキュメント
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 技術スタック
- typescript
調査の方向性
PR 60880 と issue 61354 を確認して JSX.ElementChildrenAttribute の動作変更を検証し、その後 TypeScript 5.8 のリリースノートと比較する。5.8 release-notes ページを更新し、breaking change と children の推論への影響を、報告された twrl の例をコンテキストとして説明する。
索引モデルが issue の本文から書いたものです。
説明
🔎 Search Terms
tsx, jsx, children, 5.8
🕗 Version & Regression Information
- This changed between versions 5.7.3 and 5.8
- This changed in commit or PR 60880
⏯ Playground Link
No response
💻 Code
declare global {
namespace JSX {
type Element = HTMLElement; /* return type for 'jsx()' */
/* accepted element tags & attributes */
type IntrinsicElements = {
/* All HTML elements */
[Tag in keyof HTMLElementTagNameMap]: {
[T in HTMLElementStringAttributes<Tag>]?: string | Dyn<string>;
} & {
[T in HTMLElementNumberAttributes<Tag>]?: number | Dyn<number>;
} & (Tag extends keyof TwrlOverrides ? TwrlOverrides[Tag] : {}) & {
style?: string /* note: This should probably be CSSStyleDeclaration */;
// BREAKS HERE without this: children?: Children /* defines the type of children */;
};
};
}
}
🙁 Actual behavior
The breaking change is not listed in the 5.8 Release Notes
🙂 Expected behavior
The breaking change should be listed in the 5.8 Release Notes
Additional information about the issue
I ran into issues when upgrading TypeScript and narrowed it down to 5.7.3 to 5.8. The issues is that children is not inferred by default.
Luckily I came across this discussion: https://github.com/microsoft/TypeScript/issues/61354
This led me to this PR: https://github.com/microsoft/TypeScript/pull/60880
It would have been much faster if the (breaking) change had been mentioned in the 5.8 release notes. Moreover, one (apparent?) side effect of #61354 is that children does not have a default anymore (i.e. if JSX.ElementChildrenAttribute is not set, pre-5.8 children would be accepted; post-5.8 not anymore).
Here's the JSX implementation that surfaced the issue for me:
declare global {
namespace JSX {
type Element = HTMLElement; /* return type for 'jsx()' */
/* accepted element tags & attributes */
type IntrinsicElements = {
/* All HTML elements */
[Tag in keyof HTMLElementTagNameMap]: {
[T in HTMLElementStringAttributes<Tag>]?: string | Dyn<string>;
} & {
[T in HTMLElementNumberAttributes<Tag>]?: number | Dyn<number>;
} & (Tag extends keyof TwrlOverrides ? TwrlOverrides[Tag] : {}) & {
style?: string /* note: This should probably be CSSStyleDeclaration */;
children?: Children /* defines the type of children */; // <- this is now REQUIRED
};
};
}
}
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 2日 1時間
- マージ済み PR(30日)
- 126
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/TypeScript のほかの issue
-
Possible Improvement
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
microsoft/TypeScript#64278 · コメント 1 件 · リアクション 1 件 ·
-
Docs
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
microsoft/TypeScript#64118 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
microsoft/TypeScript#64094 ·
-
Docs
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
microsoft/TypeScript#63959 · コメント 5 件 ·
-
Domain: lib.d.ts Help Wanted
難易度 1/5 1時間未満 初心者へのやさしさ 91/100
microsoft/TypeScript#63722 · コメント 4 件 · リアクション 1 件 ·
microsoft/TypeScript の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 60/100
github/gh-aw-mcpg#13748 ·
-
agentic-workflows
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
googleapis/librarian#7670 · コメント 2 件 ·