Skip to content

types: add UMD global declaration #8545

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
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/vue/types/umd.d.ts
Copy link
Member

Choose a reason for hiding this comment

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

Vue 3 only has the namespace object when using the global build. In ESM builds there are only named exports. This will be appended to the main dts file, and affect non-global build usage.

We need a separate d.ts file in dist, e.g. dist/vue.global.d.ts

Copy link
Member Author

Choose a reason for hiding this comment

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

It's not necessary. TypeScript will emit an error if users used the global object in the module file.

See https://www.typescriptlang.org/docs/handbook/modules.html#umd-modules
image

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export as namespace Vue
Loading