Add JSX.ElementChildrenAttribute change to TypeScript 5.8 release notes
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 68/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- typescript
- Lĩnh vực
- documentation
Hướng nghiên cứu
Xem xét PR 60880 và issue 61354 để xác nhận thay đổi hành vi của JSX.ElementChildrenAttribute, sau đó so sánh thay đổi này với ghi chú phát hành TypeScript 5.8. Cập nhật trang 5.8 release-notes để mô tả breaking change và ảnh hưởng của nó đến việc suy luận children, sử dụng ví dụ twrl đã được báo cáo làm ngữ cảnh.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
🔎 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
};
};
}
}
- Ngôn ngữ chính
- Go
- Star
- 111k
- Fork
- 14.4k
- Merge trung bình
- 2 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 126
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/TypeScript
-
Possible Improvement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
microsoft/TypeScript#64278 · 1 bình luận · 1 reaction ·
-
Docs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
microsoft/TypeScript#64118 · 1 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
microsoft/TypeScript#64094 ·
-
Docs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
microsoft/TypeScript#63959 · 5 bình luận ·
-
Domain: lib.d.ts Help Wanted
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
microsoft/TypeScript#63722 · 4 bình luận · 1 reaction ·
Tất cả issue của microsoft/TypeScript
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 60/100
github/gh-aw-mcpg#13748 ·
-
agentic-workflows
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
googleapis/librarian#7670 · 2 bình luận ·