-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Conversation
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 |
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
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 |
📝 Ran ecosystem CI: Open
|
1c89a60
to
429717f
Compare
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
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.