-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
adapt index.d.ts for end users #3582
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
Conversation
Would appreciate review from @ktsn @kaorun343 |
LGTM 👍 |
I was just trying out the new type definitions and had problems with importing them. I used the following alternative export * from "./vue.d";
export * from "./options.d";
export * from "./plugin.d";
export * from "./vnode.d";
import {Vue} from "./vue.d";
export default Vue; This supports several import styles and provides easy access to the other definitions besides // just import Vue
import Vue from 'vue'
new Vue(...)
// import multiple definitions
import {Vue, ComponentOptions} from 'vue'
// import 'namespace style'
import * as Vuejs from 'vue'
new Vuejs.Vue(...) What do you think? |
@@ -1,2 +1,6 @@ | |||
import {Vue} from "./vue.d"; | |||
import {Vue as _Vue} from "./vue.d"; |
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.
Why is this an import to ./vue.d
? It should probably just be ./vue
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.
Yes, it should.
@kaorun343 would you please have a look on this? I don't want to solve two different issues in one pull request.
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.
I see, I will fix this later.
@isotes The problem you're going to run into is that everyone represented CommonJS exports incorrectly, and so it's not clear what the "right" import style is going to be when the interop story is decided on. Right now, you can enable the default export behavior if you use the |
@DanielRosenwasser Thanks for the clarification! |
Related to #3509
TS declaration files need much hacks, as comments point out.
import Vue = require("vue")
is the recommended way to import vue because it does not confuse TS/JS users whether toimport default
orimport * as Vue
and it does remind user the difference of commonjs module and es module.