microsoft / TypeScript-DOM-lib-generator

Tool for generating dom related TypeScript and JavaScript library files
Apache License 2.0
622 stars 421 forks source link

Added strict typings for `ARIAMixin` with literals #1840

Open DeepDoge opened 3 weeks ago

DeepDoge commented 3 weeks ago

Added stricter typings for ARIAMixin with a fallback to also allow any other string. Also used ${bigint} and ${number} to type, integer and number only properties.

I wasn't sure if I should create a new enum type for each ARIA property, so I inlined them in the overrideType.

Fixes the issue: https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/1835

github-actions[bot] commented 3 weeks ago

Thanks for the PR!

This section of the codebase is owned by @saschanaz - if they write a comment saying "LGTM" then it will be merged.

DeepDoge commented 3 weeks ago

@microsoft-github-policy-service agree

DeepDoge commented 3 weeks ago

Removed commented items. Removed string & {} from types, and empty string from number and integer types. Updated roles based on W3C instead of MDN, filtered out deprecated and abstract ones. Added type for ariaInvalid. MDN was missing documention for ariaInvalid, but has one for aria-invalid attribute. So I missed it as well since I was looking into Element API on MDN. ariaInvalid has full browser support already.

DeepDoge commented 3 weeks ago

@saschanaz Should I include roles listed at https://www.w3.org/TR/dpub-aria-1.1/#role_definitions? Svelte includes them in [role] attribute.