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

Modify the vue-router type declaration file and enable it to support TypeScript 2.0 complier #1171

Closed
wants to merge 1 commit into from

Conversation

ulivz
Copy link
Member

@ulivz ulivz commented Feb 16, 2017

source code: import { ComponentOptions, PluginFunction } from "vue";

This source code in the TypeScript2.0 environment will be error:
" ... node_modules / vue-router / types / vue " has no exported member 'ComponentOptions'.
" ... node_modules / vue-router / types / vue " has no exported member 'PluginFunction'.

This bug can be reproduced from this project: demo

Since I have installed Vue2.0, so I directly quoted the vuejs type file.
The most reasonable thing is to remove the coupling and make it run properly.

@posva
Copy link
Member

posva commented Feb 16, 2017

I think we can safely remove the comments before merging 🙂

@ulivz
Copy link
Member Author

ulivz commented Feb 16, 2017

My PR itself is not standardized, hope vuejs as soon as possible according to my PR modify the available type declaration file.

@ktsn
Copy link
Member

ktsn commented Feb 16, 2017

Thank you for your PR. However this actually does not solve the problem.
I've investigated it again but the root cause is that @types/vue-resource depends on @types/vue which is for Vue v1 as I said on #1170.

@types/vue has the internal module declaration in it's file like declare module 'vue', thus the TS compiler no longer search vue package even if there is a vue npm package with v2 typings. That is the reason you can load the v2 typings in that case by rewriting the module path to relative path.

The compilation of vue-router is passed by this fix but you still cannot use vue-resource because it does not augment Vue v2 typings.

@posva
Copy link
Member

posva commented Oct 8, 2017

Thanks for your contribution, we'll improve typings in #1685

@posva posva closed this Oct 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants