Skip to content

Commit

Permalink
feat: add missing select types and refactor (#191)
Browse files Browse the repository at this point in the history
* 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

---------
  • Loading branch information
JacopoPatroclo authored May 2, 2024
1 parent 2fb3390 commit af06ac8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/five-wasps-hunt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@kitajs/html': minor
---

Add missing on\* events on select jsx element type definition
11 changes: 6 additions & 5 deletions packages/html/jsx.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -459,14 +459,15 @@ declare namespace JSX {
onclose?: undefined | string;
}

interface HtmlSelectTag extends HtmlTag {
interface HtmlSelectTag extends HtmlTag, FormEvents {
autofocus?: undefined | boolean;
disabled?: undefined | boolean;
form?: undefined | string;
multiple?: undefined | string;
name?: undefined | string;
required?: undefined | boolean;
size?: undefined | string;
autocomplete?: undefined | string;
}

interface HtmlSourceTag extends HtmlTag {
Expand Down Expand Up @@ -653,7 +654,7 @@ declare namespace JSX {
*
* @see https://github.com/reactjs/rfcs/pull/107
*/
key?: never;
key?: undefined | never;
}

interface ElementChildrenAttribute {
Expand Down
14 changes: 14 additions & 0 deletions packages/html/test/html-standards.test.tsx
Original file line number Diff line number Diff line change
@@ -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(
'<select onchange="jsFunctionCall()"><option value="dog">Dog</option><option value="cat">Cat</option></select>',
<select onchange="jsFunctionCall()">
<option value="dog">Dog</option>
<option value="cat">Cat</option>
</select>
);
});
});

0 comments on commit af06ac8

Please sign in to comment.