From b217306379fe905b52aa35f3a236e61690e64a53 Mon Sep 17 00:00:00 2001 From: Shiba <44804845+DeepDoge@users.noreply.github.com> Date: Sun, 3 Nov 2024 17:43:35 +0000 Subject: [PATCH 1/5] feat(ARIAMixin): Add strict typings for ARIA properties with literals --- baselines/dom.generated.d.ts | 66 +++++++-------- baselines/ts5.5/dom.generated.d.ts | 66 +++++++-------- inputfiles/overridingTypes.jsonc | 129 +++++++++++++++++++++++++++++ 3 files changed, 195 insertions(+), 66 deletions(-) diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index e6bcab554..be3ab19b1 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -2404,89 +2404,89 @@ interface ANGLE_instanced_arrays { interface ARIAMixin { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaAtomic) */ - ariaAtomic: string | null; + ariaAtomic: ("false" | "true" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaAutoComplete) */ - ariaAutoComplete: string | null; + ariaAutoComplete: ("inline" | "list" | "both" | "none" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaBrailleLabel) */ - ariaBrailleLabel: string | null; + ariaBrailleLabel: ("string" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaBrailleRoleDescription) */ - ariaBrailleRoleDescription: string | null; + ariaBrailleRoleDescription: ("string" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaBusy) */ - ariaBusy: string | null; + ariaBusy: ("true" | "false" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaChecked) */ - ariaChecked: string | null; + ariaChecked: ("true" | "mixed" | "false" | "undefined" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaColCount) */ - ariaColCount: string | null; + ariaColCount: `${bigint}` | "" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaColIndex) */ - ariaColIndex: string | null; + ariaColIndex: `${bigint}` | "" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaColIndexText) */ ariaColIndexText: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaColSpan) */ - ariaColSpan: string | null; + ariaColSpan: `${bigint}` | "" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaCurrent) */ - ariaCurrent: string | null; + ariaCurrent: ("page" | "step" | "location" | "date" | "time" | "true" | "false" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaDescription) */ ariaDescription: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaDisabled) */ - ariaDisabled: string | null; + ariaDisabled: ("true" | "false" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaExpanded) */ - ariaExpanded: string | null; + ariaExpanded: ("true" | "false" | "undefined" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaHasPopup) */ - ariaHasPopup: string | null; + ariaHasPopup: ("false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaHidden) */ - ariaHidden: string | null; + ariaHidden: ("true" | "false" | "undefined" | (string & {})) | null; ariaInvalid: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaKeyShortcuts) */ ariaKeyShortcuts: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaLabel) */ ariaLabel: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaLevel) */ - ariaLevel: string | null; + ariaLevel: `${bigint}` | "" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaLive) */ - ariaLive: string | null; + ariaLive: ("assertive" | "off" | "polite" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaModal) */ - ariaModal: string | null; + ariaModal: ("true" | "false" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaMultiLine) */ - ariaMultiLine: string | null; + ariaMultiLine: ("true" | "false" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaMultiSelectable) */ - ariaMultiSelectable: string | null; + ariaMultiSelectable: ("true" | "false" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaOrientation) */ - ariaOrientation: string | null; + ariaOrientation: ("horizontal" | "vertical" | "undefined" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaPlaceholder) */ ariaPlaceholder: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaPosInSet) */ - ariaPosInSet: string | null; + ariaPosInSet: `${bigint}` | "" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaPressed) */ - ariaPressed: string | null; + ariaPressed: ("true" | "false" | "mixed" | "undefined" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaReadOnly) */ - ariaReadOnly: string | null; + ariaReadOnly: ("true" | "false" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRequired) */ ariaRequired: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRoleDescription) */ ariaRoleDescription: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRowCount) */ - ariaRowCount: string | null; + ariaRowCount: `${bigint}` | "" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRowIndex) */ - ariaRowIndex: string | null; + ariaRowIndex: `${bigint}` | "" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRowIndexText) */ ariaRowIndexText: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRowSpan) */ - ariaRowSpan: string | null; + ariaRowSpan: `${bigint}` | "" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaSelected) */ - ariaSelected: string | null; + ariaSelected: ("true" | "false" | "undefined" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaSetSize) */ - ariaSetSize: string | null; + ariaSetSize: `${bigint}` | "" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaSort) */ - ariaSort: string | null; + ariaSort: ("ascending" | "descending" | "none" | "other" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaValueMax) */ - ariaValueMax: string | null; + ariaValueMax: `${number}` | "" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaValueMin) */ - ariaValueMin: string | null; + ariaValueMin: `${number}` | "" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaValueNow) */ - ariaValueNow: string | null; + ariaValueNow: `${number}` | "" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaValueText) */ ariaValueText: string | null; - role: string | null; + role: ("toolbar" | "tooltip" | "feed" | "math" | "presentation" | "none" | "note" | "application" | "article" | "cell" | "columnheader" | "definition" | "directory" | "document" | "figure" | "group" | "heading" | "img" | "list" | "listitem" | "meter" | "row" | "rowgroup" | "rowheader" | "separator" | "table" | "term" | "associationlist" | "associationlistitemkey" | "associationlistitemvalue" | "blockquote" | "caption" | "code" | "deletion" | "emphasis" | "insertion" | "paragraph" | "strong" | "subscript" | "superscript" | "time" | "scrollbar" | "searchbox" | "separator" | "slider" | "spinbutton" | "switch" | "tab" | "tabpanel" | "treeitem" | "combobox" | "menu" | "menubar" | "tablist" | "tree" | "treegrid" | "banner" | "complementary" | "contentinfo" | "form" | "main" | "navigation" | "region" | "search" | "alert" | "log" | "marquee" | "status" | "timer" | "alertdialog" | "dialog" | (string & {})) | null; } /** diff --git a/baselines/ts5.5/dom.generated.d.ts b/baselines/ts5.5/dom.generated.d.ts index a32b8e889..84198b8db 100644 --- a/baselines/ts5.5/dom.generated.d.ts +++ b/baselines/ts5.5/dom.generated.d.ts @@ -2404,89 +2404,89 @@ interface ANGLE_instanced_arrays { interface ARIAMixin { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaAtomic) */ - ariaAtomic: string | null; + ariaAtomic: ("false" | "true" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaAutoComplete) */ - ariaAutoComplete: string | null; + ariaAutoComplete: ("inline" | "list" | "both" | "none" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaBrailleLabel) */ - ariaBrailleLabel: string | null; + ariaBrailleLabel: ("string" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaBrailleRoleDescription) */ - ariaBrailleRoleDescription: string | null; + ariaBrailleRoleDescription: ("string" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaBusy) */ - ariaBusy: string | null; + ariaBusy: ("true" | "false" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaChecked) */ - ariaChecked: string | null; + ariaChecked: ("true" | "mixed" | "false" | "undefined" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaColCount) */ - ariaColCount: string | null; + ariaColCount: `${bigint}` | "" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaColIndex) */ - ariaColIndex: string | null; + ariaColIndex: `${bigint}` | "" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaColIndexText) */ ariaColIndexText: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaColSpan) */ - ariaColSpan: string | null; + ariaColSpan: `${bigint}` | "" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaCurrent) */ - ariaCurrent: string | null; + ariaCurrent: ("page" | "step" | "location" | "date" | "time" | "true" | "false" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaDescription) */ ariaDescription: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaDisabled) */ - ariaDisabled: string | null; + ariaDisabled: ("true" | "false" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaExpanded) */ - ariaExpanded: string | null; + ariaExpanded: ("true" | "false" | "undefined" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaHasPopup) */ - ariaHasPopup: string | null; + ariaHasPopup: ("false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaHidden) */ - ariaHidden: string | null; + ariaHidden: ("true" | "false" | "undefined" | (string & {})) | null; ariaInvalid: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaKeyShortcuts) */ ariaKeyShortcuts: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaLabel) */ ariaLabel: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaLevel) */ - ariaLevel: string | null; + ariaLevel: `${bigint}` | "" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaLive) */ - ariaLive: string | null; + ariaLive: ("assertive" | "off" | "polite" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaModal) */ - ariaModal: string | null; + ariaModal: ("true" | "false" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaMultiLine) */ - ariaMultiLine: string | null; + ariaMultiLine: ("true" | "false" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaMultiSelectable) */ - ariaMultiSelectable: string | null; + ariaMultiSelectable: ("true" | "false" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaOrientation) */ - ariaOrientation: string | null; + ariaOrientation: ("horizontal" | "vertical" | "undefined" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaPlaceholder) */ ariaPlaceholder: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaPosInSet) */ - ariaPosInSet: string | null; + ariaPosInSet: `${bigint}` | "" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaPressed) */ - ariaPressed: string | null; + ariaPressed: ("true" | "false" | "mixed" | "undefined" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaReadOnly) */ - ariaReadOnly: string | null; + ariaReadOnly: ("true" | "false" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRequired) */ ariaRequired: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRoleDescription) */ ariaRoleDescription: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRowCount) */ - ariaRowCount: string | null; + ariaRowCount: `${bigint}` | "" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRowIndex) */ - ariaRowIndex: string | null; + ariaRowIndex: `${bigint}` | "" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRowIndexText) */ ariaRowIndexText: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRowSpan) */ - ariaRowSpan: string | null; + ariaRowSpan: `${bigint}` | "" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaSelected) */ - ariaSelected: string | null; + ariaSelected: ("true" | "false" | "undefined" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaSetSize) */ - ariaSetSize: string | null; + ariaSetSize: `${bigint}` | "" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaSort) */ - ariaSort: string | null; + ariaSort: ("ascending" | "descending" | "none" | "other" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaValueMax) */ - ariaValueMax: string | null; + ariaValueMax: `${number}` | "" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaValueMin) */ - ariaValueMin: string | null; + ariaValueMin: `${number}` | "" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaValueNow) */ - ariaValueNow: string | null; + ariaValueNow: `${number}` | "" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaValueText) */ ariaValueText: string | null; - role: string | null; + role: ("toolbar" | "tooltip" | "feed" | "math" | "presentation" | "none" | "note" | "application" | "article" | "cell" | "columnheader" | "definition" | "directory" | "document" | "figure" | "group" | "heading" | "img" | "list" | "listitem" | "meter" | "row" | "rowgroup" | "rowheader" | "separator" | "table" | "term" | "associationlist" | "associationlistitemkey" | "associationlistitemvalue" | "blockquote" | "caption" | "code" | "deletion" | "emphasis" | "insertion" | "paragraph" | "strong" | "subscript" | "superscript" | "time" | "scrollbar" | "searchbox" | "separator" | "slider" | "spinbutton" | "switch" | "tab" | "tabpanel" | "treeitem" | "combobox" | "menu" | "menubar" | "tablist" | "tree" | "treegrid" | "banner" | "complementary" | "contentinfo" | "form" | "main" | "navigation" | "region" | "search" | "alert" | "log" | "marquee" | "status" | "timer" | "alertdialog" | "dialog" | (string & {})) | null; } /** diff --git a/inputfiles/overridingTypes.jsonc b/inputfiles/overridingTypes.jsonc index 3a59532c6..534601c03 100644 --- a/inputfiles/overridingTypes.jsonc +++ b/inputfiles/overridingTypes.jsonc @@ -286,6 +286,135 @@ } } } + }, + "ARIAMixin": { + "properties": { + "property": { + "ariaColCount": { + "overrideType": "`${bigint}` | \"\"" + }, + "ariaColIndex": { + "overrideType": "`${bigint}` | \"\"" + }, + // "ariaColIndexText": { + // "overrideType": "" + // }, + "ariaColSpan": { + "overrideType": "`${bigint}` | \"\"" + }, + "ariaCurrent": { + "overrideType": "\"page\" | \"step\" | \"location\" | \"date\" | \"time\" | \"true\" | \"false\" | (string & {})" + }, + // "ariaDescription": { + // "overrideType": "" + // }, + "ariaAtomic": { + "overrideType": "\"false\" | \"true\" | (string & {})" + }, + "ariaAutoComplete": { + "overrideType": "\"inline\" | \"list\" | \"both\" | \"none\" | (string & {})" + }, + "ariaBrailleLabel": { + "overrideType": "\"string\" | (string & {})" + }, + "ariaBrailleRoleDescription": { + "overrideType": "\"string\" | (string & {})" + }, + "ariaBusy": { + "overrideType": "\"true\" | \"false\" | (string & {})" + }, + "ariaChecked": { + "overrideType": "\"true\" | \"mixed\" | \"false\" | \"undefined\" | (string & {})" + }, + "ariaDisabled": { + "overrideType": "\"true\" | \"false\" | (string & {})" + }, + "ariaExpanded": { + "overrideType": "\"true\" | \"false\" | \"undefined\" | (string & {})" + }, + "ariaHasPopup": { + "overrideType": "\"false\" | \"true\" | \"menu\" | \"listbox\" | \"tree\" | \"grid\" | \"dialog\" | (string & {})" + }, + "ariaHidden": { + "overrideType": "\"true\" | \"false\" | \"undefined\" | (string & {})" + }, + // "ariaKeyShortcuts": { + // "overrideType": "" + // }, + // "ariaLabel": { + // "overrideType": "" + // }, + "ariaLevel": { + "overrideType": "`${bigint}` | \"\"" + }, + "ariaLive": { + "overrideType": "\"assertive\" | \"off\" | \"polite\" | (string & {})" + }, + "ariaModal": { + "overrideType": "\"true\" | \"false\" | (string & {})" + }, + "ariaMultiLine": { + "overrideType": "\"true\" | \"false\" | (string & {})" + }, + "ariaMultiSelectable": { + "overrideType": "\"true\" | \"false\" | (string & {})" + }, + "ariaOrientation": { + "overrideType": "\"horizontal\" | \"vertical\" | \"undefined\" | (string & {})" + }, + // "ariaPlaceholder": { + // "overrideType": "" + // }, + "ariaPosInSet": { + "overrideType": "`${bigint}` | \"\"" + }, + "ariaPressed": { + "overrideType": "\"true\" | \"false\" | \"mixed\" | \"undefined\" | (string & {})" + }, + "ariaReadOnly": { + "overrideType": "\"true\" | \"false\" | (string & {})" + }, + // "ariaRoleDescription": { + // "overrideType": "" + // }, + "ariaRowCount": { + "overrideType": "`${bigint}` | \"\"" + }, + "ariaRowIndex": { + "overrideType": "`${bigint}` | \"\"" + }, + // "ariaRowIndexText": { + // "overrideType": "" + // }, + "ariaRowSpan": { + "overrideType": "`${bigint}` | \"\"" + }, + "ariaSelected": { + "overrideType": "\"true\" | \"false\" | \"undefined\" | (string & {})" + }, + "ariaSetSize": { + "overrideType": "`${bigint}` | \"\"" + }, + "ariaSort": { + "overrideType": "\"ascending\" | \"descending\" | \"none\" | \"other\" | (string & {})" + }, + "ariaValueMax": { + "overrideType": "`${number}` | \"\"" + }, + "ariaValueMin": { + "overrideType": "`${number}` | \"\"" + }, + "ariaValueNow": { + "overrideType": "`${number}` | \"\"" + }, + // "ariaValueText": { + // "overrideType": "" + // } + "role": { + "overrideType": "\"toolbar\" | \"tooltip\" | \"feed\" | \"math\" | \"presentation\" | \"none\" | \"note\" | \"application\" | \"article\" | \"cell\" | \"columnheader\" | \"definition\" | \"directory\" | \"document\" | \"figure\" | \"group\" | \"heading\" | \"img\" | \"list\" | \"listitem\" | \"meter\" | \"row\" | \"rowgroup\" | \"rowheader\" | \"separator\" | \"table\" | \"term\" | \"associationlist\" | \"associationlistitemkey\" | \"associationlistitemvalue\" | \"blockquote\" | \"caption\" | \"code\" | \"deletion\" | \"emphasis\" | \"insertion\" | \"paragraph\" | \"strong\" | \"subscript\" | \"superscript\" | \"time\" | \"scrollbar\" | \"searchbox\" | \"separator\" | \"slider\" | \"spinbutton\" | \"switch\" | \"tab\" | \"tabpanel\" | \"treeitem\" | \"combobox\" | \"menu\" | \"menubar\" | \"tablist\" | \"tree\" | \"treegrid\" | \"banner\" | \"complementary\" | \"contentinfo\" | \"form\" | \"main\" | \"navigation\" | \"region\" | \"search\" | \"alert\" | \"log\" | \"marquee\" | \"status\" | \"timer\" | \"alertdialog\" | \"dialog\" | (string & {})" + } + } + } } } }, From 807b62b1dc04a13b4198811fdaa3d218a86a5bc4 Mon Sep 17 00:00:00 2001 From: Shiba <44804845+DeepDoge@users.noreply.github.com> Date: Sun, 3 Nov 2024 18:06:34 +0000 Subject: [PATCH 2/5] fix(ARIAMixin): Removed string literal types for `ariaBrailleLabel` and `ariaBrailleRoleDescription` --- baselines/dom.generated.d.ts | 4 ++-- baselines/ts5.5/dom.generated.d.ts | 4 ++-- inputfiles/overridingTypes.jsonc | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index be3ab19b1..f6819d0e0 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -2408,9 +2408,9 @@ interface ARIAMixin { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaAutoComplete) */ ariaAutoComplete: ("inline" | "list" | "both" | "none" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaBrailleLabel) */ - ariaBrailleLabel: ("string" | (string & {})) | null; + ariaBrailleLabel: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaBrailleRoleDescription) */ - ariaBrailleRoleDescription: ("string" | (string & {})) | null; + ariaBrailleRoleDescription: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaBusy) */ ariaBusy: ("true" | "false" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaChecked) */ diff --git a/baselines/ts5.5/dom.generated.d.ts b/baselines/ts5.5/dom.generated.d.ts index 84198b8db..9e7fc2db4 100644 --- a/baselines/ts5.5/dom.generated.d.ts +++ b/baselines/ts5.5/dom.generated.d.ts @@ -2408,9 +2408,9 @@ interface ARIAMixin { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaAutoComplete) */ ariaAutoComplete: ("inline" | "list" | "both" | "none" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaBrailleLabel) */ - ariaBrailleLabel: ("string" | (string & {})) | null; + ariaBrailleLabel: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaBrailleRoleDescription) */ - ariaBrailleRoleDescription: ("string" | (string & {})) | null; + ariaBrailleRoleDescription: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaBusy) */ ariaBusy: ("true" | "false" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaChecked) */ diff --git a/inputfiles/overridingTypes.jsonc b/inputfiles/overridingTypes.jsonc index 534601c03..f1fed119b 100644 --- a/inputfiles/overridingTypes.jsonc +++ b/inputfiles/overridingTypes.jsonc @@ -314,12 +314,12 @@ "ariaAutoComplete": { "overrideType": "\"inline\" | \"list\" | \"both\" | \"none\" | (string & {})" }, - "ariaBrailleLabel": { - "overrideType": "\"string\" | (string & {})" - }, - "ariaBrailleRoleDescription": { - "overrideType": "\"string\" | (string & {})" - }, + // "ariaBrailleLabel": { + // "overrideType": "" + // }, + // "ariaBrailleRoleDescription": { + // "overrideType": "" + // }, "ariaBusy": { "overrideType": "\"true\" | \"false\" | (string & {})" }, From acdd5ab659dcff407ff3de466b65c8d74eb49a95 Mon Sep 17 00:00:00 2001 From: Shiba <44804845+DeepDoge@users.noreply.github.com> Date: Sun, 3 Nov 2024 18:13:59 +0000 Subject: [PATCH 3/5] fix(ARIAMixin): Added string literal types for `ariaRequired` --- baselines/dom.generated.d.ts | 2 +- baselines/ts5.5/dom.generated.d.ts | 2 +- inputfiles/overridingTypes.jsonc | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index f6819d0e0..ea854b010 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -2461,7 +2461,7 @@ interface ARIAMixin { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaReadOnly) */ ariaReadOnly: ("true" | "false" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRequired) */ - ariaRequired: string | null; + ariaRequired: ("true" | "false" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRoleDescription) */ ariaRoleDescription: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRowCount) */ diff --git a/baselines/ts5.5/dom.generated.d.ts b/baselines/ts5.5/dom.generated.d.ts index 9e7fc2db4..ed78c8973 100644 --- a/baselines/ts5.5/dom.generated.d.ts +++ b/baselines/ts5.5/dom.generated.d.ts @@ -2461,7 +2461,7 @@ interface ARIAMixin { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaReadOnly) */ ariaReadOnly: ("true" | "false" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRequired) */ - ariaRequired: string | null; + ariaRequired: ("true" | "false" | (string & {})) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRoleDescription) */ ariaRoleDescription: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRowCount) */ diff --git a/inputfiles/overridingTypes.jsonc b/inputfiles/overridingTypes.jsonc index f1fed119b..10bc7ee17 100644 --- a/inputfiles/overridingTypes.jsonc +++ b/inputfiles/overridingTypes.jsonc @@ -374,6 +374,9 @@ "ariaReadOnly": { "overrideType": "\"true\" | \"false\" | (string & {})" }, + "ariaRequired": { + "overrideType": "\"true\" | \"false\" | (string & {})" + }, // "ariaRoleDescription": { // "overrideType": "" // }, From c6faa1c7830ea294cf19561b188c6b2976d814e5 Mon Sep 17 00:00:00 2001 From: Shiba <44804845+DeepDoge@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:33:42 +0000 Subject: [PATCH 4/5] fix(ARIAMixin): Improve type definitions and enums - Remove commented items - Remove `string & {}` from types - Remove empty strings from number types - Update and export roles as enum `ARIARole` - Add type for `ariaInvalid` - Add unit tests --- baselines/dom.generated.d.ts | 67 +++--- baselines/ts5.5/dom.generated.d.ts | 67 +++--- inputfiles/addedTypes.jsonc | 90 +++++++++ inputfiles/overridingTypes.jsonc | 101 ++++----- unittests/files/aria.ts | 315 +++++++++++++++++++++++++++++ 5 files changed, 510 insertions(+), 130 deletions(-) create mode 100644 unittests/files/aria.ts diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index ea854b010..1a6fea574 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -2404,89 +2404,89 @@ interface ANGLE_instanced_arrays { interface ARIAMixin { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaAtomic) */ - ariaAtomic: ("false" | "true" | (string & {})) | null; + ariaAtomic: "false" | "true" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaAutoComplete) */ - ariaAutoComplete: ("inline" | "list" | "both" | "none" | (string & {})) | null; + ariaAutoComplete: "inline" | "list" | "both" | "none" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaBrailleLabel) */ ariaBrailleLabel: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaBrailleRoleDescription) */ ariaBrailleRoleDescription: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaBusy) */ - ariaBusy: ("true" | "false" | (string & {})) | null; + ariaBusy: "true" | "false" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaChecked) */ - ariaChecked: ("true" | "mixed" | "false" | "undefined" | (string & {})) | null; + ariaChecked: "true" | "mixed" | "false" | "undefined" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaColCount) */ - ariaColCount: `${bigint}` | "" | null; + ariaColCount: `${bigint}` | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaColIndex) */ - ariaColIndex: `${bigint}` | "" | null; + ariaColIndex: `${bigint}` | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaColIndexText) */ ariaColIndexText: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaColSpan) */ - ariaColSpan: `${bigint}` | "" | null; + ariaColSpan: `${bigint}` | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaCurrent) */ - ariaCurrent: ("page" | "step" | "location" | "date" | "time" | "true" | "false" | (string & {})) | null; + ariaCurrent: "page" | "step" | "location" | "date" | "time" | "true" | "false" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaDescription) */ ariaDescription: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaDisabled) */ - ariaDisabled: ("true" | "false" | (string & {})) | null; + ariaDisabled: "true" | "false" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaExpanded) */ - ariaExpanded: ("true" | "false" | "undefined" | (string & {})) | null; + ariaExpanded: "true" | "false" | "undefined" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaHasPopup) */ - ariaHasPopup: ("false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | (string & {})) | null; + ariaHasPopup: "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaHidden) */ - ariaHidden: ("true" | "false" | "undefined" | (string & {})) | null; - ariaInvalid: string | null; + ariaHidden: "true" | "false" | "undefined" | null; + ariaInvalid: "true" | "false" | "grammar" | "spelling" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaKeyShortcuts) */ ariaKeyShortcuts: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaLabel) */ ariaLabel: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaLevel) */ - ariaLevel: `${bigint}` | "" | null; + ariaLevel: `${bigint}` | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaLive) */ - ariaLive: ("assertive" | "off" | "polite" | (string & {})) | null; + ariaLive: "assertive" | "off" | "polite" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaModal) */ - ariaModal: ("true" | "false" | (string & {})) | null; + ariaModal: "true" | "false" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaMultiLine) */ - ariaMultiLine: ("true" | "false" | (string & {})) | null; + ariaMultiLine: "true" | "false" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaMultiSelectable) */ - ariaMultiSelectable: ("true" | "false" | (string & {})) | null; + ariaMultiSelectable: "true" | "false" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaOrientation) */ - ariaOrientation: ("horizontal" | "vertical" | "undefined" | (string & {})) | null; + ariaOrientation: "horizontal" | "vertical" | "undefined" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaPlaceholder) */ ariaPlaceholder: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaPosInSet) */ - ariaPosInSet: `${bigint}` | "" | null; + ariaPosInSet: `${bigint}` | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaPressed) */ - ariaPressed: ("true" | "false" | "mixed" | "undefined" | (string & {})) | null; + ariaPressed: "true" | "false" | "mixed" | "undefined" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaReadOnly) */ - ariaReadOnly: ("true" | "false" | (string & {})) | null; + ariaReadOnly: "true" | "false" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRequired) */ - ariaRequired: ("true" | "false" | (string & {})) | null; + ariaRequired: "true" | "false" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRoleDescription) */ ariaRoleDescription: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRowCount) */ - ariaRowCount: `${bigint}` | "" | null; + ariaRowCount: `${bigint}` | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRowIndex) */ - ariaRowIndex: `${bigint}` | "" | null; + ariaRowIndex: `${bigint}` | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRowIndexText) */ ariaRowIndexText: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRowSpan) */ - ariaRowSpan: `${bigint}` | "" | null; + ariaRowSpan: `${bigint}` | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaSelected) */ - ariaSelected: ("true" | "false" | "undefined" | (string & {})) | null; + ariaSelected: "true" | "false" | "undefined" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaSetSize) */ - ariaSetSize: `${bigint}` | "" | null; + ariaSetSize: `${bigint}` | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaSort) */ - ariaSort: ("ascending" | "descending" | "none" | "other" | (string & {})) | null; + ariaSort: "ascending" | "descending" | "none" | "other" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaValueMax) */ - ariaValueMax: `${number}` | "" | null; + ariaValueMax: `${number}` | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaValueMin) */ - ariaValueMin: `${number}` | "" | null; + ariaValueMin: `${number}` | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaValueNow) */ - ariaValueNow: `${number}` | "" | null; + ariaValueNow: `${number}` | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaValueText) */ ariaValueText: string | null; - role: ("toolbar" | "tooltip" | "feed" | "math" | "presentation" | "none" | "note" | "application" | "article" | "cell" | "columnheader" | "definition" | "directory" | "document" | "figure" | "group" | "heading" | "img" | "list" | "listitem" | "meter" | "row" | "rowgroup" | "rowheader" | "separator" | "table" | "term" | "associationlist" | "associationlistitemkey" | "associationlistitemvalue" | "blockquote" | "caption" | "code" | "deletion" | "emphasis" | "insertion" | "paragraph" | "strong" | "subscript" | "superscript" | "time" | "scrollbar" | "searchbox" | "separator" | "slider" | "spinbutton" | "switch" | "tab" | "tabpanel" | "treeitem" | "combobox" | "menu" | "menubar" | "tablist" | "tree" | "treegrid" | "banner" | "complementary" | "contentinfo" | "form" | "main" | "navigation" | "region" | "search" | "alert" | "log" | "marquee" | "status" | "timer" | "alertdialog" | "dialog" | (string & {})) | null; + role: ARIARole | null; } /** @@ -28947,6 +28947,7 @@ type Uint32List = Uint32Array | GLuint[]; type VibratePattern = number | number[]; type WindowProxy = Window; type XMLHttpRequestBodyInit = Blob | BufferSource | FormData | URLSearchParams | string; +type ARIARole = "alert" | "alertdialog" | "application" | "article" | "banner" | "blockquote" | "button" | "caption" | "cell" | "checkbox" | "code" | "columnheader" | "combobox" | "comment" | "complementary" | "contentinfo" | "definition" | "deletion" | "dialog" | "document" | "emphasis" | "feed" | "figure" | "form" | "generic" | "grid" | "gridcell" | "group" | "heading" | "image" | "img" | "insertion" | "link" | "list" | "listbox" | "listitem" | "log" | "main" | "mark" | "marquee" | "math" | "menu" | "menubar" | "menuitem" | "menuitemcheckbox" | "menuitemradio" | "meter" | "navigation" | "none" | "note" | "option" | "paragraph" | "presentation" | "progressbar" | "radio" | "radiogroup" | "region" | "row" | "rowgroup" | "rowheader" | "scrollbar" | "search" | "searchbox" | "separator" | "slider" | "spinbutton" | "status" | "strong" | "subscript" | "suggestion" | "superscript" | "switch" | "tab" | "table" | "tablist" | "tabpanel" | "term" | "textbox" | "time" | "timer" | "toolbar" | "tooltip" | "tree" | "treegrid" | "treeitem"; type AlignSetting = "center" | "end" | "left" | "right" | "start"; type AlphaOption = "discard" | "keep"; type AnimationPlayState = "finished" | "idle" | "paused" | "running"; diff --git a/baselines/ts5.5/dom.generated.d.ts b/baselines/ts5.5/dom.generated.d.ts index ed78c8973..d399e823a 100644 --- a/baselines/ts5.5/dom.generated.d.ts +++ b/baselines/ts5.5/dom.generated.d.ts @@ -2404,89 +2404,89 @@ interface ANGLE_instanced_arrays { interface ARIAMixin { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaAtomic) */ - ariaAtomic: ("false" | "true" | (string & {})) | null; + ariaAtomic: "false" | "true" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaAutoComplete) */ - ariaAutoComplete: ("inline" | "list" | "both" | "none" | (string & {})) | null; + ariaAutoComplete: "inline" | "list" | "both" | "none" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaBrailleLabel) */ ariaBrailleLabel: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaBrailleRoleDescription) */ ariaBrailleRoleDescription: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaBusy) */ - ariaBusy: ("true" | "false" | (string & {})) | null; + ariaBusy: "true" | "false" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaChecked) */ - ariaChecked: ("true" | "mixed" | "false" | "undefined" | (string & {})) | null; + ariaChecked: "true" | "mixed" | "false" | "undefined" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaColCount) */ - ariaColCount: `${bigint}` | "" | null; + ariaColCount: `${bigint}` | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaColIndex) */ - ariaColIndex: `${bigint}` | "" | null; + ariaColIndex: `${bigint}` | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaColIndexText) */ ariaColIndexText: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaColSpan) */ - ariaColSpan: `${bigint}` | "" | null; + ariaColSpan: `${bigint}` | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaCurrent) */ - ariaCurrent: ("page" | "step" | "location" | "date" | "time" | "true" | "false" | (string & {})) | null; + ariaCurrent: "page" | "step" | "location" | "date" | "time" | "true" | "false" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaDescription) */ ariaDescription: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaDisabled) */ - ariaDisabled: ("true" | "false" | (string & {})) | null; + ariaDisabled: "true" | "false" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaExpanded) */ - ariaExpanded: ("true" | "false" | "undefined" | (string & {})) | null; + ariaExpanded: "true" | "false" | "undefined" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaHasPopup) */ - ariaHasPopup: ("false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | (string & {})) | null; + ariaHasPopup: "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaHidden) */ - ariaHidden: ("true" | "false" | "undefined" | (string & {})) | null; - ariaInvalid: string | null; + ariaHidden: "true" | "false" | "undefined" | null; + ariaInvalid: "true" | "false" | "grammar" | "spelling" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaKeyShortcuts) */ ariaKeyShortcuts: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaLabel) */ ariaLabel: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaLevel) */ - ariaLevel: `${bigint}` | "" | null; + ariaLevel: `${bigint}` | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaLive) */ - ariaLive: ("assertive" | "off" | "polite" | (string & {})) | null; + ariaLive: "assertive" | "off" | "polite" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaModal) */ - ariaModal: ("true" | "false" | (string & {})) | null; + ariaModal: "true" | "false" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaMultiLine) */ - ariaMultiLine: ("true" | "false" | (string & {})) | null; + ariaMultiLine: "true" | "false" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaMultiSelectable) */ - ariaMultiSelectable: ("true" | "false" | (string & {})) | null; + ariaMultiSelectable: "true" | "false" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaOrientation) */ - ariaOrientation: ("horizontal" | "vertical" | "undefined" | (string & {})) | null; + ariaOrientation: "horizontal" | "vertical" | "undefined" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaPlaceholder) */ ariaPlaceholder: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaPosInSet) */ - ariaPosInSet: `${bigint}` | "" | null; + ariaPosInSet: `${bigint}` | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaPressed) */ - ariaPressed: ("true" | "false" | "mixed" | "undefined" | (string & {})) | null; + ariaPressed: "true" | "false" | "mixed" | "undefined" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaReadOnly) */ - ariaReadOnly: ("true" | "false" | (string & {})) | null; + ariaReadOnly: "true" | "false" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRequired) */ - ariaRequired: ("true" | "false" | (string & {})) | null; + ariaRequired: "true" | "false" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRoleDescription) */ ariaRoleDescription: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRowCount) */ - ariaRowCount: `${bigint}` | "" | null; + ariaRowCount: `${bigint}` | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRowIndex) */ - ariaRowIndex: `${bigint}` | "" | null; + ariaRowIndex: `${bigint}` | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRowIndexText) */ ariaRowIndexText: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRowSpan) */ - ariaRowSpan: `${bigint}` | "" | null; + ariaRowSpan: `${bigint}` | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaSelected) */ - ariaSelected: ("true" | "false" | "undefined" | (string & {})) | null; + ariaSelected: "true" | "false" | "undefined" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaSetSize) */ - ariaSetSize: `${bigint}` | "" | null; + ariaSetSize: `${bigint}` | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaSort) */ - ariaSort: ("ascending" | "descending" | "none" | "other" | (string & {})) | null; + ariaSort: "ascending" | "descending" | "none" | "other" | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaValueMax) */ - ariaValueMax: `${number}` | "" | null; + ariaValueMax: `${number}` | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaValueMin) */ - ariaValueMin: `${number}` | "" | null; + ariaValueMin: `${number}` | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaValueNow) */ - ariaValueNow: `${number}` | "" | null; + ariaValueNow: `${number}` | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaValueText) */ ariaValueText: string | null; - role: ("toolbar" | "tooltip" | "feed" | "math" | "presentation" | "none" | "note" | "application" | "article" | "cell" | "columnheader" | "definition" | "directory" | "document" | "figure" | "group" | "heading" | "img" | "list" | "listitem" | "meter" | "row" | "rowgroup" | "rowheader" | "separator" | "table" | "term" | "associationlist" | "associationlistitemkey" | "associationlistitemvalue" | "blockquote" | "caption" | "code" | "deletion" | "emphasis" | "insertion" | "paragraph" | "strong" | "subscript" | "superscript" | "time" | "scrollbar" | "searchbox" | "separator" | "slider" | "spinbutton" | "switch" | "tab" | "tabpanel" | "treeitem" | "combobox" | "menu" | "menubar" | "tablist" | "tree" | "treegrid" | "banner" | "complementary" | "contentinfo" | "form" | "main" | "navigation" | "region" | "search" | "alert" | "log" | "marquee" | "status" | "timer" | "alertdialog" | "dialog" | (string & {})) | null; + role: ARIARole | null; } /** @@ -28928,6 +28928,7 @@ type Uint32List = Uint32Array | GLuint[]; type VibratePattern = number | number[]; type WindowProxy = Window; type XMLHttpRequestBodyInit = Blob | BufferSource | FormData | URLSearchParams | string; +type ARIARole = "alert" | "alertdialog" | "application" | "article" | "banner" | "blockquote" | "button" | "caption" | "cell" | "checkbox" | "code" | "columnheader" | "combobox" | "comment" | "complementary" | "contentinfo" | "definition" | "deletion" | "dialog" | "document" | "emphasis" | "feed" | "figure" | "form" | "generic" | "grid" | "gridcell" | "group" | "heading" | "image" | "img" | "insertion" | "link" | "list" | "listbox" | "listitem" | "log" | "main" | "mark" | "marquee" | "math" | "menu" | "menubar" | "menuitem" | "menuitemcheckbox" | "menuitemradio" | "meter" | "navigation" | "none" | "note" | "option" | "paragraph" | "presentation" | "progressbar" | "radio" | "radiogroup" | "region" | "row" | "rowgroup" | "rowheader" | "scrollbar" | "search" | "searchbox" | "separator" | "slider" | "spinbutton" | "status" | "strong" | "subscript" | "suggestion" | "superscript" | "switch" | "tab" | "table" | "tablist" | "tabpanel" | "term" | "textbox" | "time" | "timer" | "toolbar" | "tooltip" | "tree" | "treegrid" | "treeitem"; type AlignSetting = "center" | "end" | "left" | "right" | "start"; type AlphaOption = "discard" | "keep"; type AnimationPlayState = "finished" | "idle" | "paused" | "running"; diff --git a/inputfiles/addedTypes.jsonc b/inputfiles/addedTypes.jsonc index 89274967d..2e654100a 100644 --- a/inputfiles/addedTypes.jsonc +++ b/inputfiles/addedTypes.jsonc @@ -445,6 +445,96 @@ "value": [ "webauthn" ] + }, + "ARIARole": { + "name": "ARIARole", + "value": [ + "alert", + "alertdialog", + "application", + "article", + "banner", + "blockquote", + "button", + "caption", + "cell", + "checkbox", + "code", + "columnheader", + "combobox", + "comment", + "complementary", + "contentinfo", + "definition", + "deletion", + "dialog", + "document", + "emphasis", + "feed", + "figure", + "form", + "generic", + "grid", + "gridcell", + "group", + "heading", + "image", + "img", + "insertion", + "link", + "list", + "listbox", + "listitem", + "log", + "main", + "mark", + "marquee", + "math", + "menu", + "menubar", + "menuitem", + "menuitemcheckbox", + "menuitemradio", + "meter", + "navigation", + "none", + "note", + "option", + "paragraph", + "presentation", + "progressbar", + "radio", + "radiogroup", + "region", + "row", + "rowgroup", + "rowheader", + "scrollbar", + "search", + "searchbox", + "separator", + "slider", + "spinbutton", + "status", + "strong", + "subscript", + "suggestion", + "superscript", + "switch", + "tab", + "table", + "tablist", + "tabpanel", + "term", + "textbox", + "time", + "timer", + "toolbar", + "tooltip", + "tree", + "treegrid", + "treeitem" + ] } } }, diff --git a/inputfiles/overridingTypes.jsonc b/inputfiles/overridingTypes.jsonc index 10bc7ee17..70f086c92 100644 --- a/inputfiles/overridingTypes.jsonc +++ b/inputfiles/overridingTypes.jsonc @@ -291,130 +291,103 @@ "properties": { "property": { "ariaColCount": { - "overrideType": "`${bigint}` | \"\"" + "overrideType": "`${bigint}`" }, "ariaColIndex": { - "overrideType": "`${bigint}` | \"\"" + "overrideType": "`${bigint}`" }, - // "ariaColIndexText": { - // "overrideType": "" - // }, "ariaColSpan": { - "overrideType": "`${bigint}` | \"\"" + "overrideType": "`${bigint}`" }, "ariaCurrent": { - "overrideType": "\"page\" | \"step\" | \"location\" | \"date\" | \"time\" | \"true\" | \"false\" | (string & {})" + "overrideType": "\"page\" | \"step\" | \"location\" | \"date\" | \"time\" | \"true\" | \"false\"" }, - // "ariaDescription": { - // "overrideType": "" - // }, "ariaAtomic": { - "overrideType": "\"false\" | \"true\" | (string & {})" + "overrideType": "\"false\" | \"true\"" }, "ariaAutoComplete": { - "overrideType": "\"inline\" | \"list\" | \"both\" | \"none\" | (string & {})" - }, - // "ariaBrailleLabel": { - // "overrideType": "" - // }, - // "ariaBrailleRoleDescription": { - // "overrideType": "" - // }, + "overrideType": "\"inline\" | \"list\" | \"both\" | \"none\"" + }, "ariaBusy": { - "overrideType": "\"true\" | \"false\" | (string & {})" + "overrideType": "\"true\" | \"false\"" }, "ariaChecked": { - "overrideType": "\"true\" | \"mixed\" | \"false\" | \"undefined\" | (string & {})" + "overrideType": "\"true\" | \"mixed\" | \"false\" | \"undefined\"" }, "ariaDisabled": { - "overrideType": "\"true\" | \"false\" | (string & {})" + "overrideType": "\"true\" | \"false\"" }, "ariaExpanded": { - "overrideType": "\"true\" | \"false\" | \"undefined\" | (string & {})" + "overrideType": "\"true\" | \"false\" | \"undefined\"" }, "ariaHasPopup": { - "overrideType": "\"false\" | \"true\" | \"menu\" | \"listbox\" | \"tree\" | \"grid\" | \"dialog\" | (string & {})" + "overrideType": "\"false\" | \"true\" | \"menu\" | \"listbox\" | \"tree\" | \"grid\" | \"dialog\"" }, "ariaHidden": { - "overrideType": "\"true\" | \"false\" | \"undefined\" | (string & {})" - }, - // "ariaKeyShortcuts": { - // "overrideType": "" - // }, - // "ariaLabel": { - // "overrideType": "" - // }, + "overrideType": "\"true\" | \"false\" | \"undefined\"" + }, + "ariaInvalid": { + "overrideType": "\"true\" | \"false\" | \"grammar\" | \"spelling\"" + }, "ariaLevel": { - "overrideType": "`${bigint}` | \"\"" + "overrideType": "`${bigint}`" }, "ariaLive": { - "overrideType": "\"assertive\" | \"off\" | \"polite\" | (string & {})" + "overrideType": "\"assertive\" | \"off\" | \"polite\"" }, "ariaModal": { - "overrideType": "\"true\" | \"false\" | (string & {})" + "overrideType": "\"true\" | \"false\"" }, "ariaMultiLine": { - "overrideType": "\"true\" | \"false\" | (string & {})" + "overrideType": "\"true\" | \"false\"" }, "ariaMultiSelectable": { - "overrideType": "\"true\" | \"false\" | (string & {})" + "overrideType": "\"true\" | \"false\"" }, "ariaOrientation": { - "overrideType": "\"horizontal\" | \"vertical\" | \"undefined\" | (string & {})" + "overrideType": "\"horizontal\" | \"vertical\" | \"undefined\"" }, - // "ariaPlaceholder": { - // "overrideType": "" - // }, "ariaPosInSet": { - "overrideType": "`${bigint}` | \"\"" + "overrideType": "`${bigint}`" }, "ariaPressed": { - "overrideType": "\"true\" | \"false\" | \"mixed\" | \"undefined\" | (string & {})" + "overrideType": "\"true\" | \"false\" | \"mixed\" | \"undefined\"" }, "ariaReadOnly": { - "overrideType": "\"true\" | \"false\" | (string & {})" + "overrideType": "\"true\" | \"false\"" }, "ariaRequired": { - "overrideType": "\"true\" | \"false\" | (string & {})" + "overrideType": "\"true\" | \"false\"" }, - // "ariaRoleDescription": { - // "overrideType": "" - // }, "ariaRowCount": { - "overrideType": "`${bigint}` | \"\"" + "overrideType": "`${bigint}`" }, "ariaRowIndex": { - "overrideType": "`${bigint}` | \"\"" + "overrideType": "`${bigint}`" }, - // "ariaRowIndexText": { - // "overrideType": "" - // }, "ariaRowSpan": { - "overrideType": "`${bigint}` | \"\"" + "overrideType": "`${bigint}`" }, "ariaSelected": { - "overrideType": "\"true\" | \"false\" | \"undefined\" | (string & {})" + "overrideType": "\"true\" | \"false\" | \"undefined\"" }, "ariaSetSize": { - "overrideType": "`${bigint}` | \"\"" + "overrideType": "`${bigint}`" }, "ariaSort": { - "overrideType": "\"ascending\" | \"descending\" | \"none\" | \"other\" | (string & {})" + "overrideType": "\"ascending\" | \"descending\" | \"none\" | \"other\"" }, "ariaValueMax": { - "overrideType": "`${number}` | \"\"" + "overrideType": "`${number}`" }, "ariaValueMin": { - "overrideType": "`${number}` | \"\"" + "overrideType": "`${number}`" }, "ariaValueNow": { - "overrideType": "`${number}` | \"\"" + "overrideType": "`${number}`" }, - // "ariaValueText": { - // "overrideType": "" - // } "role": { - "overrideType": "\"toolbar\" | \"tooltip\" | \"feed\" | \"math\" | \"presentation\" | \"none\" | \"note\" | \"application\" | \"article\" | \"cell\" | \"columnheader\" | \"definition\" | \"directory\" | \"document\" | \"figure\" | \"group\" | \"heading\" | \"img\" | \"list\" | \"listitem\" | \"meter\" | \"row\" | \"rowgroup\" | \"rowheader\" | \"separator\" | \"table\" | \"term\" | \"associationlist\" | \"associationlistitemkey\" | \"associationlistitemvalue\" | \"blockquote\" | \"caption\" | \"code\" | \"deletion\" | \"emphasis\" | \"insertion\" | \"paragraph\" | \"strong\" | \"subscript\" | \"superscript\" | \"time\" | \"scrollbar\" | \"searchbox\" | \"separator\" | \"slider\" | \"spinbutton\" | \"switch\" | \"tab\" | \"tabpanel\" | \"treeitem\" | \"combobox\" | \"menu\" | \"menubar\" | \"tablist\" | \"tree\" | \"treegrid\" | \"banner\" | \"complementary\" | \"contentinfo\" | \"form\" | \"main\" | \"navigation\" | \"region\" | \"search\" | \"alert\" | \"log\" | \"marquee\" | \"status\" | \"timer\" | \"alertdialog\" | \"dialog\" | (string & {})" + "type": "ARIARole" } } } diff --git a/unittests/files/aria.ts b/unittests/files/aria.ts new file mode 100644 index 000000000..85c47e6d1 --- /dev/null +++ b/unittests/files/aria.ts @@ -0,0 +1,315 @@ +switch (document.body.ariaAtomic) { + case "true": + case "false": + case null: + break; + default: + document.body.ariaAtomic satisfies never; +} + +switch (document.body.ariaAutoComplete) { + case "both": + case "inline": + case "list": + case "none": + case null: + break; + default: + document.body.ariaAutoComplete satisfies never; +} + +document.body.ariaBrailleLabel = "abc"; +document.body.ariaBrailleLabel = null; + +document.body.ariaBrailleRoleDescription = "abc"; +document.body.ariaBrailleRoleDescription = null; + +switch (document.body.ariaBusy) { + case "true": + case "false": + case null: + break; + default: + document.body.ariaBusy satisfies never; +} + +switch (document.body.ariaChecked) { + case "true": + case "mixed": + case "false": + case "undefined": + case null: + break; + default: + document.body.ariaChecked satisfies never; +} + +document.body.ariaColCount = "1"; +document.body.ariaColCount = null; +/// @ts-expect-error does not accept float type +document.body.ariaColCount = "1.1"; +/// @ts-expect-error does not accept empty string +document.body.ariaColCount = ""; + +document.body.ariaColIndex = "1"; +document.body.ariaColIndex = null; +/// @ts-expect-error does not accept float type +document.body.ariaColIndex = "1.1"; +/// @ts-expect-error does not accept empty string +document.body.ariaColIndex = ""; + +document.body.ariaColIndexText = "abc"; +document.body.ariaColCount = null; + +document.body.ariaColSpan = "1"; +document.body.ariaColSpan = null; +/// @ts-expect-error does not accept float type +document.body.ariaColSpan = "1.1"; +/// @ts-expect-error does not accept empty string +document.body.ariaColSpan = ""; + +switch (document.body.ariaCurrent) { + case "true": + case "false": + case "date": + case "location": + case "page": + case "step": + case "time": + case null: + break; + default: + document.body.ariaCurrent satisfies never; +} + +document.body.ariaDescription = "abc"; +document.body.ariaDescription = null; + +switch (document.body.ariaDisabled) { + case "true": + case "false": + case null: + break; + default: + document.body.ariaDisabled satisfies never; +} + +switch (document.body.ariaExpanded) { + case "true": + case "false": + case "undefined": + case null: + break; + default: + document.body.ariaExpanded satisfies never; +} + +switch (document.body.ariaHasPopup) { + case "true": + case "false": + case "dialog": + case "grid": + case "listbox": + case "menu": + case "tree": + case null: + break; + default: + document.body.ariaHasPopup satisfies never; +} + +switch (document.body.ariaHidden) { + case "true": + case "false": + case "undefined": + case null: + break; + default: + document.body.ariaHidden satisfies never; +} + +switch (document.body.ariaInvalid) { + case "true": + case "false": + case "grammar": + case "spelling": + case null: + break; + default: + document.body.ariaInvalid satisfies never; +} + +document.body.ariaKeyShortcuts = "Alt+Enter"; +document.body.ariaKeyShortcuts = null; + +document.body.ariaLabel = "abc"; +document.body.ariaLabel = null; + +document.body.ariaLevel = "1"; +document.body.ariaLevel = null; +/// @ts-expect-error does not accept float type +document.body.ariaLevel = "1.1"; +/// @ts-expect-error does not accept empty string +document.body.ariaLevel = ""; + +switch (document.body.ariaLive) { + case "assertive": + case "off": + case "polite": + case null: + break; + default: + document.body.ariaLive satisfies never; +} + +switch (document.body.ariaModal) { + case "true": + case "false": + case null: + break; + default: + document.body.ariaModal satisfies never; +} + +switch (document.body.ariaMultiLine) { + case "true": + case "false": + case null: + break; + default: + document.body.ariaMultiLine satisfies never; +} + +switch (document.body.ariaMultiSelectable) { + case "true": + case "false": + case null: + break; + default: + document.body.ariaMultiSelectable satisfies never; +} + +switch (document.body.ariaOrientation) { + case "horizontal": + case "undefined": + case "vertical": + case null: + break; + default: + document.body.ariaOrientation satisfies never; +} + +document.body.ariaPlaceholder = "abc"; +document.body.ariaPlaceholder = null; + +document.body.ariaPosInSet = "1"; +document.body.ariaPosInSet = null; +/// @ts-expect-error does not accept float type +document.body.ariaPosInSet = "1.1"; +/// @ts-expect-error does not accept empty string +document.body.ariaPosInSet = ""; + +switch (document.body.ariaPressed) { + case "false": + case "mixed": + case "true": + case "undefined": + case null: + break; + default: + document.body.ariaPressed satisfies never; +} + +switch (document.body.ariaReadOnly) { + case "false": + case "true": + case null: + break; + default: + document.body.ariaReadOnly satisfies never; +} + +switch (document.body.ariaRequired) { + case "false": + case "true": + case null: + break; + default: + document.body.ariaRequired satisfies never; +} + +document.body.ariaRoleDescription = "abc"; +document.body.ariaRoleDescription = null; + +document.body.ariaRowCount = "1"; +document.body.ariaRowCount = null; +/// @ts-expect-error does not accept float type +document.body.ariaRowCount = "1.1"; +/// @ts-expect-error does not accept empty string +document.body.ariaRowCount = ""; + +document.body.ariaRowIndex = "1"; +document.body.ariaRowIndex = null; +/// @ts-expect-error does not accept float type +document.body.ariaRowIndex = "1.1"; +/// @ts-expect-error does not accept empty string +document.body.ariaRowIndex = ""; + +document.body.ariaRowIndexText = "abc"; +document.body.ariaRowIndexText = null; + +document.body.ariaRowSpan = "1"; +document.body.ariaRowSpan = null; +/// @ts-expect-error does not accept float type +document.body.ariaRowSpan = "1.1"; +/// @ts-expect-error does not accept empty string +document.body.ariaRowSpan = ""; + +switch (document.body.ariaSelected) { + case "true": + case "false": + case "undefined": + case null: + break; + default: + document.body.ariaSelected satisfies never; +} + +document.body.ariaSetSize = "1"; +document.body.ariaSetSize = null; +/// @ts-expect-error does not accept float type +document.body.ariaSetSize = "1.1"; +/// @ts-expect-error does not accept empty string +document.body.ariaSetSize = ""; + +switch (document.body.ariaSort) { + case "ascending": + case "descending": + case "none": + case "other": + case null: + break; + default: + document.body.ariaSort satisfies never; +} + +document.body.ariaValueMax = "1"; +document.body.ariaValueMax = "1.1"; +document.body.ariaValueMax = null; +/// @ts-expect-error does not accept empty string +document.body.ariaValueMax = ""; + +document.body.ariaValueMin = "1"; +document.body.ariaValueMin = "1.1"; +document.body.ariaValueMin = null; +/// @ts-expect-error does not accept empty string +document.body.ariaValueMin = ""; + +document.body.ariaValueNow = "1"; +document.body.ariaValueNow = "1.1"; +document.body.ariaValueNow = null; +/// @ts-expect-error does not accept empty string +document.body.ariaValueNow = ""; + +document.body.ariaValueText = "abc"; +document.body.ariaValueText = null; From b52decf7fb7c4f90cd530504a012ba0697b22f6b Mon Sep 17 00:00:00 2001 From: Shiba <44804845+DeepDoge@users.noreply.github.com> Date: Mon, 4 Nov 2024 14:03:16 +0000 Subject: [PATCH 5/5] fix(ARIAMixin): Add unit test for `role` --- unittests/files/aria.ts | 92 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/unittests/files/aria.ts b/unittests/files/aria.ts index 85c47e6d1..455b2d691 100644 --- a/unittests/files/aria.ts +++ b/unittests/files/aria.ts @@ -313,3 +313,95 @@ document.body.ariaValueNow = ""; document.body.ariaValueText = "abc"; document.body.ariaValueText = null; + +switch (document.body.role) { + case "alert": + case "alertdialog": + case "application": + case "article": + case "banner": + case "blockquote": + case "button": + case "caption": + case "cell": + case "checkbox": + case "code": + case "columnheader": + case "combobox": + case "comment": + case "complementary": + case "contentinfo": + case "definition": + case "deletion": + case "dialog": + case "document": + case "emphasis": + case "feed": + case "figure": + case "form": + case "generic": + case "grid": + case "gridcell": + case "group": + case "heading": + case "image": + case "img": + case "insertion": + case "link": + case "list": + case "listbox": + case "listitem": + case "log": + case "main": + case "mark": + case "marquee": + case "math": + case "menu": + case "menubar": + case "menuitem": + case "menuitemcheckbox": + case "menuitemradio": + case "meter": + case "navigation": + case "none": + case "note": + case "option": + case "paragraph": + case "presentation": + case "progressbar": + case "radio": + case "radiogroup": + case "region": + case "row": + case "rowgroup": + case "rowheader": + case "scrollbar": + case "search": + case "searchbox": + case "separator": + case "slider": + case "spinbutton": + case "status": + case "strong": + case "subscript": + case "suggestion": + case "superscript": + case "switch": + case "tab": + case "table": + case "tablist": + case "tabpanel": + case "term": + case "textbox": + case "time": + case "timer": + case "toolbar": + case "tooltip": + case "tree": + case "treegrid": + case "treeitem": + case null: + break; + default: + document.body.role satisfies never; +}