Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Add JSX.ElementChildrenAttribute change to TypeScript 5.8 release notes

Đang mở Phù hợp với người mới
#63,212 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

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ả

Docs
🔎 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
        };
    };
  }
}

Fix: https://github.com/nmattia/twrl/commit/d83fde44202536c52f2816094fdcc4910c945c85#diff-8e3158c55134a198f9c40ac714ce358df04312a9ca77d7726e1813fb2ba5b5c0R34

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

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/TypeScript

Tất cả issue của microsoft/TypeScript

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.