Skip to content
Myr

feat(jsx): improve `type` (MIME) attribute types (#3305)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* feat(jsx): improve `type` (MIME) attribute types embed, link, object, script, source, and style elements * fix(jsx): `source` element allows only media mime in type attribute

authored by TOMIKAWA Sotaro · committed by GitHub · parent 0a94e53 · Browse files · 1 file+13 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+13 added−6 removed

  • other:+13 added−6 removed

1 file+13 added−6 removed

modified:src/jsx/intrinsic-elements.ts+13 added-6 removed
285 unmodified lines
286287 interface EmbedHTMLAttributes extends HTMLAttributes {288 height?: number | string | undefined289 src?: string | undefined290 type?: string | undefined290 type?: StringLiteralUnion<BaseMime> | undefined291 width?: number | string | undefined292 }293294 interface FieldsetHTMLAttributes extends HTMLAttributes {
199 unmodified lines
494 imagesrcset?: string | undefined495 imagesizes?: string | undefined496 referrerpolicy?: HTMLAttributeReferrerPolicy | undefined497 sizes?: string | undefined498 type?: string | undefined498 type?: StringLiteralUnion<BaseMime> | undefined499 charSet?: string | undefined500501 // React 19 compatibility502 rel?: string | undefined
103 unmodified lines
606 data?: string | undefined607 form?: string | undefined608 height?: number | string | undefined609 name?: string | undefined610 type?: string | undefined610 type?: StringLiteralUnion<BaseMime> | undefined611 usemap?: string | undefined612 width?: number | string | undefined613 }614
42 unmodified lines
657 integrity?: string | undefined658 nomodule?: boolean | undefined659 referrerpolicy?: HTMLAttributeReferrerPolicy | undefined660 src?: string | undefined661 type?: string | undefined661 /**662 * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type663 */664 type?: StringLiteralUnion<'' | 'text/javascript' | 'importmap' | 'module'> | undefined665666 // React 19 compatibility667 crossOrigin?: CrossOrigin668 fetchPriority?: string | undefined
14 unmodified lines
683 size?: number | undefined684 value?: string | ReadonlyArray<string> | number | undefined685 }686687 type MediaMime = BaseMime & (`image/${string}` | `audio/${string}` | `video/${string}`)688 interface SourceHTMLAttributes extends HTMLAttributes {689 height?: number | string | undefined690 media?: string | undefined691 sizes?: string | undefined692 src?: string | undefined693 srcset?: string | undefined690 type?: string | undefined694 type?: StringLiteralUnion<MediaMime> | undefined695 width?: number | string | undefined696 }697698 interface StyleHTMLAttributes extends HTMLAttributes {699 media?: string | undefined700 scoped?: boolean | undefined701 /**702 * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style#type703 */697 type?: string | undefined704 type?: '' | 'text/css' | undefined705706 // React 19 compatibility707 href?: string | undefined708 precedence?: string | undefined
198 unmodified lines