0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-21 18:18:57 +01:00

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

* 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
This commit is contained in:
TOMIKAWA Sotaro 2024-08-26 21:14:31 +09:00 committed by GitHub
parent 0a94e53832
commit 33189b8765
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -287,7 +287,7 @@ export namespace JSX {
interface EmbedHTMLAttributes extends HTMLAttributes {
height?: number | string | undefined
src?: string | undefined
type?: string | undefined
type?: StringLiteralUnion<BaseMime> | undefined
width?: number | string | undefined
}
@ -495,7 +495,7 @@ export namespace JSX {
imagesizes?: string | undefined
referrerpolicy?: HTMLAttributeReferrerPolicy | undefined
sizes?: string | undefined
type?: string | undefined
type?: StringLiteralUnion<BaseMime> | undefined
charSet?: string | undefined
// React 19 compatibility
@ -607,7 +607,7 @@ export namespace JSX {
form?: string | undefined
height?: number | string | undefined
name?: string | undefined
type?: string | undefined
type?: StringLiteralUnion<BaseMime> | undefined
usemap?: string | undefined
width?: number | string | undefined
}
@ -658,7 +658,10 @@ export namespace JSX {
nomodule?: boolean | undefined
referrerpolicy?: HTMLAttributeReferrerPolicy | undefined
src?: string | undefined
type?: string | undefined
/**
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type
*/
type?: StringLiteralUnion<'' | 'text/javascript' | 'importmap' | 'module'> | undefined
// React 19 compatibility
crossOrigin?: CrossOrigin
@ -681,20 +684,24 @@ export namespace JSX {
value?: string | ReadonlyArray<string> | number | undefined
}
type MediaMime = BaseMime & (`image/${string}` | `audio/${string}` | `video/${string}`)
interface SourceHTMLAttributes extends HTMLAttributes {
height?: number | string | undefined
media?: string | undefined
sizes?: string | undefined
src?: string | undefined
srcset?: string | undefined
type?: string | undefined
type?: StringLiteralUnion<MediaMime> | undefined
width?: number | string | undefined
}
interface StyleHTMLAttributes extends HTMLAttributes {
media?: string | undefined
scoped?: boolean | undefined
type?: string | undefined
/**
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style#type
*/
type?: '' | 'text/css' | undefined
// React 19 compatibility
href?: string | undefined