Skip to content

Remove index signature from CSSProperties #12988

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

sarayourfriend
Copy link

This allows for actually using strongly typed hyphen properties in CSS. In the current version, the comment above it is wrong. This was likely copied from the React types and never fixed to reflect the fact that the index signature was included back: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react/index.d.ts#L1577-L1584

The reason for including this signature is not clear to me and doesn't appear to be in the code history. Does the project require some hyphen properties to be available? In that case, then Vue should define those explicitly and I can make the changes in this PR. Otherwise, this index signature makes the types measurably worse for everyone else using Vue's types in their own projects with strict CSS property types.

Notably, this also differs from Vue's own guide on CSSProperties: https://vuejs.org/api/utility-types.html#cssproperties

With the current implementation, the instructions on that documentation page are essentially useless, no one would ever need them (unless they're doing something like Houdini and adding new non-hyphen CSS properties).

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

Applications relying on the index signature that currently allows all hyphen properties will need to follow the Vue guide for updating CSSProperties: https://vuejs.org/api/utility-types.html#cssproperties

The PR fulfills these requirements:

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

This allows for actually using strongly typed hyphen properties in CSS. In the current version, the comment above it is wrong. This was likely copied from the React types and never fixed to reflect the fact that the index signature was included back: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react/index.d.ts#L1577-L1584

The reason for including this signature is not clear to me and doesn't appear to be in the code history. Does the project require some hyphen properties to be available? In that case, then Vue should define those explicitly and I can make the changes in this PR. Otherwise, this index signature makes the types measurably worse for everyone else using Vue's types in their own projects with strict CSS property types.
sarayourfriend added a commit to WordPress/openverse that referenced this pull request Mar 20, 2023
These types are built into Vue 2.7 and are no longer necessary as a separate dependency

Unfortunately the types included with Vue have worse CSS types and our existing method for stricting typing CSS hyphenated properties no longer works. I have opened a PR (vuejs/vue#12988) to fix this in Vue, but there is no way for us to work around it at the moment other than just removing the strict hyphen property types and ignoring the fact that they are now effectively typed as `any`
sarayourfriend added a commit to WordPress/openverse that referenced this pull request Mar 26, 2023
…gration (#951)

* Remove @vue/runtime-dom

These types are built into Vue 2.7 and are no longer necessary as a separate dependency

Unfortunately the types included with Vue have worse CSS types and our existing method for stricting typing CSS hyphenated properties no longer works. I have opened a PR (vuejs/vue#12988) to fix this in Vue, but there is no way for us to work around it at the moment other than just removing the strict hyphen property types and ignoring the fact that they are now effectively typed as `any`

* Fix TS build to use composite project
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