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
fix: move JSX DOM types back to @vue/runtime-dom
#7979
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Otherwise TypeScript will raise TS2322 errors. I have no idea why and how does the fix work. But it does. Even importing the `ReservedProps` and `NativeElements` types from `jsx-runtime` instead of declaring them in the module would fail the tests. I have no idea why, either. The failing tests are at https://github.com/vuejs/ecosystem-ci/actions/runs/4538928668/jobs/7998297656#step:7:3
Fixes use cases such as https://github.com/vuetifyjs/vuetify/blob/29777628ac8839c0548e869d3d350ed9fdcbb149/packages/vuetify/src/shims.d.ts#L18-L25 Adds a new `./jsx.d.ts` entry in `@vue/runtime-dom` to avoid duplication in `vue`. It should be removed in 3.4 when we stop registering global JSX namespace by default.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Drops `vue/jsx-runtime/dom`. The previous commits didn't work because imported (and re-exported) types cannot be augmented. So I give up on the idea of moving the DOM types to `vue/jsx-runtime`. They don't pollute the global namespace anyway. There's still one caveat that I have to import the `IntrinsicElementAttributes` type from `@vue/runtime-dom/dist/runtime-dom` rather than using the package name as entry. Seems because in this monorepo, TypeScript always picks up the source file (`index.ts`) over the built file (`dist/runtime-dom.d.ts` as specified in the `types` field in `package.json`)
/ecosystem-ci run vuetify |
yyx990803
reviewed
Mar 29, 2023
packages/vue/jsx-runtime/index.d.ts
Outdated
VNode, | ||
VNodeRef, | ||
IntrinsicElementAttributes | ||
} from '@vue/runtime-dom/dist/runtime-dom' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be just @vue/runtime-dom
right?
declare module '@vue/runtime-dom'
@vue/runtime-dom
yyx990803
reviewed
Mar 29, 2023
packages/vue/jsx.d.ts
Outdated
VNode, | ||
VNodeRef, | ||
IntrinsicElementAttributes | ||
} from '@vue/runtime-dom/dist/runtime-dom' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
This comment was marked as outdated.
This comment was marked as outdated.
/ecosystem-ci run |
|
1c89a60
to
429717f
Compare
/ecosystem-ci run |
|
IAmSSH
pushed a commit
to IAmSSH/core
that referenced
this pull request
May 14, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Based on #7978, please merge that PR first.
Allows augmenting JSX types within
declare module '@vue/runtime-dom'
.Fixes use cases such as https://github.com/vuetifyjs/vuetify/blob/29777628ac8839c0548e869d3d350ed9fdcbb149/packages/vuetify/src/shims.d.ts#L18-L25
Drops
vue/jsx-runtime/dom
.Because imported (and re-exported) types cannot be augmented, so having the types in 2 different places would certainly break something. So I give up on moving the DOM types to
vue/jsx-runtime
.They don't pollute the global namespace anyway.