Skip to content

Commit

Permalink
feat(jsx): improve form attribute types (#3330)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssssota authored Aug 29, 2024
1 parent bc2b7cf commit e449c95
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/jsx/intrinsic-elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ export namespace JSX {
interface ButtonHTMLAttributes extends HTMLAttributes {
disabled?: boolean | undefined
form?: string | undefined
formenctype?: string | undefined
formmethod?: string | undefined
formenctype?: HTMLAttributeFormEnctype | undefined
formmethod?: HTMLAttributeFormMethod | undefined
formnovalidate?: boolean | undefined
formtarget?: HTMLAttributeAnchorTarget | undefined
name?: string | undefined
Expand Down Expand Up @@ -303,11 +303,21 @@ export namespace JSX {
name?: string | undefined
}

/** @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#method */
type HTMLAttributeFormMethod = 'get' | 'post' | 'dialog'
/** @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#enctype */
type HTMLAttributeFormEnctype =
| 'application/x-www-form-urlencoded'
| 'multipart/form-data'
| 'text/plain'
/** @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#autocomplete */
type HTMLAttributeFormAutocomplete = 'on' | 'off'

interface FormHTMLAttributes extends HTMLAttributes {
'accept-charset'?: string | undefined
autocomplete?: string | undefined
enctype?: string | undefined
method?: string | undefined
'accept-charset'?: StringLiteralUnion<'utf-8'> | undefined
autocomplete?: HTMLAttributeFormAutocomplete | undefined
enctype?: HTMLAttributeFormEnctype | undefined
method?: HTMLAttributeFormMethod | undefined
name?: string | undefined
novalidate?: boolean | undefined
target?: HTMLAttributeAnchorTarget | undefined
Expand Down Expand Up @@ -446,8 +456,8 @@ export namespace JSX {
checked?: boolean | undefined
disabled?: boolean | undefined
form?: string | undefined
formenctype?: string | undefined
formmethod?: string | undefined
formenctype?: HTMLAttributeFormEnctype | undefined
formmethod?: HTMLAttributeFormMethod | undefined
formnovalidate?: boolean | undefined
formtarget?: HTMLAttributeAnchorTarget | undefined
height?: number | string | undefined
Expand Down

0 comments on commit e449c95

Please sign in to comment.