Skip to content
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

[TypeScript] Default export of the module has or is using private name 'VueConstructor' #6999

Closed
gluons opened this issue Nov 4, 2017 · 4 comments · Fixed by #7002
Closed

Comments

@gluons
Copy link

gluons commented Nov 4, 2017

Version

2.5.3

Reproduction link

https://github.com/gluons/vue-issue-6999

Steps to reproduce

  • Export some object that contain Vue or typeof Vue types.
  • Set compilerOptions -> declaration to true

What is expected?

Able to build without error.

It should be able to export plugin/library with TypeScript declaration.

What is actually happening?

Default export of the module has or is using private name 'VueConstructor' happened when built it.


I'm developing Vue component with TypeScript.
I also need TypeScript to generate declaration for other TypeScript developer (And also JavaScript with Vetur 🙂).
But I face this error. 😢

Thanks bbuchanan for the cause.

@gluons gluons changed the title Default export of the module has or is using private name 'VueConstructor' [TypeScript] Default export of the module has or is using private name 'VueConstructor' Nov 4, 2017
@ktsn
Copy link
Member

ktsn commented Nov 5, 2017

I've made a PR to expose VueConstructor #7002
In the meantime, you can manually annotate the install function by PluginFunction

export default {
  install: install as PluginFunction<void>
}

gluons added a commit to gluons/vue-thailand-address that referenced this issue Nov 5, 2017
@relign
Copy link

relign commented Dec 31, 2017

Version
2.5.13
image
I try [email protected], when set compilerOptions.declaration = true in tsconfig.json,it export error
Default export of the module has or is using private name 'VueConstructor'.
image

@gluons
Copy link
Author

gluons commented May 30, 2018

@relign Try importing VueConstructor above your code.

import { VueConstructor } from 'vue';
/* or */
import Vue, { VueConstructor } from 'vue'; // With Vue

@trusktr
Copy link

trusktr commented Dec 21, 2019

I've opened a request to fix issues like these in TypeScript by bringing declaration files to parity with language features. microsoft/TypeScript#35822

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

Successfully merging a pull request may close this issue.

4 participants