From af06ac88a066c61cf66c0a0667a942a7bf2c5dd9 Mon Sep 17 00:00:00 2001 From: Jacopo Patroclo Martinelli <42748150+JacopoPatroclo@users.noreply.github.com> Date: Thu, 2 May 2024 20:57:16 +0900 Subject: [PATCH] feat: add missing select types and refactor (#191) * wip(html): add select missing types, removed duplicate undefined from all types ? means undefined * wip(html): readd undefined due to possible incopat with exactOptionalPropertyTypes ts option * chore(html): run changeset script --------- --- .changeset/five-wasps-hunt.md | 5 +++++ packages/html/jsx.d.ts | 11 ++++++----- packages/html/test/html-standards.test.tsx | 14 ++++++++++++++ 3 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 .changeset/five-wasps-hunt.md create mode 100644 packages/html/test/html-standards.test.tsx diff --git a/.changeset/five-wasps-hunt.md b/.changeset/five-wasps-hunt.md new file mode 100644 index 000000000..ff71cfcac --- /dev/null +++ b/.changeset/five-wasps-hunt.md @@ -0,0 +1,5 @@ +--- +'@kitajs/html': minor +--- + +Add missing on\* events on select jsx element type definition diff --git a/packages/html/jsx.d.ts b/packages/html/jsx.d.ts index 471ac0121..f15ad8e8b 100644 --- a/packages/html/jsx.d.ts +++ b/packages/html/jsx.d.ts @@ -279,9 +279,9 @@ declare namespace JSX { ismap?: undefined | string; width?: undefined | number | string; height?: undefined | number | string; - decoding?: 'sync' | 'async' | 'auto' | AnyString; - loading?: 'eager' | 'lazy' | AnyString; - srcset?: string; + decoding?: undefined | 'sync' | 'async' | 'auto' | AnyString; + loading?: undefined | 'eager' | 'lazy' | AnyString; + srcset?: undefined | string; } interface HtmlInputTag extends HtmlTag { @@ -459,7 +459,7 @@ declare namespace JSX { onclose?: undefined | string; } - interface HtmlSelectTag extends HtmlTag { + interface HtmlSelectTag extends HtmlTag, FormEvents { autofocus?: undefined | boolean; disabled?: undefined | boolean; form?: undefined | string; @@ -467,6 +467,7 @@ declare namespace JSX { name?: undefined | string; required?: undefined | boolean; size?: undefined | string; + autocomplete?: undefined | string; } interface HtmlSourceTag extends HtmlTag { @@ -653,7 +654,7 @@ declare namespace JSX { * * @see https://github.com/reactjs/rfcs/pull/107 */ - key?: never; + key?: undefined | never; } interface ElementChildrenAttribute { diff --git a/packages/html/test/html-standards.test.tsx b/packages/html/test/html-standards.test.tsx new file mode 100644 index 000000000..0fd9c02ed --- /dev/null +++ b/packages/html/test/html-standards.test.tsx @@ -0,0 +1,14 @@ +import assert from 'node:assert'; +import test, { describe } from 'node:test'; + +describe('Expose correct html standards types', () => { + test('Select', () => { + assert.equal( + '', + + ); + }); +});