Skip to content

Use a narrow type for htmlElementAttributes#14

Open
mkantor wants to merge 1 commit intowooorm:mainfrom
mkantor:narrow-type
Open

Use a narrow type for htmlElementAttributes#14
mkantor wants to merge 1 commit intowooorm:mainfrom
mkantor:narrow-type

Conversation

@mkantor
Copy link
Copy Markdown

@mkantor mkantor commented Sep 15, 2025

A const assertion is now used for htmlElementAttributes to make its TypeScript type include specific element & attribute names.

Here's what the type looks like now:

Screenshot 2025-09-15 at 5 52 48 PM

* @type {Record<string, Array<string>>}
*/
export const htmlElementAttributes = {
export const htmlElementAttributes = /** @type {const} */ ({
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file wasn't actually regenerated, just manually edited. I did run the generator but it also spat out a bunch of other changes that I thought you'd want to review separately.

A [const assertion][1] is now used for `htmlElementAttributes` to make
its TypeScript type include specific element & attribute names.

[1]: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions
@mkantor
Copy link
Copy Markdown
Author

mkantor commented Sep 15, 2025

If you like this then I could send similar pull requests to your related projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant