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

Improve typescript documentation to show how to use vue without imports that would require module bundler #2042

Closed
realmerx opened this issue Mar 3, 2019 · 6 comments

Comments

@realmerx
Copy link

realmerx commented Mar 3, 2019

Since currently type definitions for vue need to be exported, you have to use import:

//ItemComponentl.ts
import Vue from 'vue'

const ItemComponent = Vue.extend({
})

To get them work without import you can create custom type definition with declare global:

//global.d.ts - name does not matter
import { VueConstructor } from 'vue'

declare global {
    const Vue: VueConstructor
}
@realmerx realmerx changed the title Improve typescript documentation to show how to use vue without imports that require module bundler Improve typescript documentation to show how to use vue without imports that would require module bundler Mar 3, 2019
@phanan
Copy link
Member

phanan commented Mar 3, 2019

Sorry, I'm lost. What part of the documentation are we looking at?

@realmerx
Copy link
Author

realmerx commented Mar 4, 2019

No, I am sorry for not being clear enough :) https://vuejs.org/v2/guide/typescript.html

@phanan
Copy link
Member

phanan commented Mar 4, 2019

Right, thanks! Still, I'm not very sure what change(s) you want to see there. Do you think a PR would explain your intention better?

@realmerx
Copy link
Author

realmerx commented Mar 4, 2019

Sure, I'll create a pull request for this.

@realmerx
Copy link
Author

Finally got time to do that :)

#2137

@NataliaTepluhina
Copy link
Member

Thank you for spotting this issue and for your work on the related PR!

Closing this now as vuejs/vue#9912 got merged and now we can use global Vue without any additional setup required.

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

No branches or pull requests

4 participants