Skip to content

Add AsyncComponent type to RouteOptions.component #1619

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

Merged
merged 2 commits into from
Aug 30, 2017
Merged

Conversation

kaleb
Copy link
Contributor

@kaleb kaleb commented Jul 19, 2017

AsyncComponent is currently allowed, but typescript is giving me a bogus error. This type definition update fixes this.

AsyncComponent is currently allowed, but typescript is giving me a bogus error. This type definition update fixes this.
Copy link
Member

@posva posva left a comment

Choose a reason for hiding this comment

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

@ktsn Is it worth to add a test for this?

@ktsn
Copy link
Member

ktsn commented Jul 23, 2017

@posva Yeah, a test would be helpful.

@posva
Copy link
Member

posva commented Aug 22, 2017

hey @kaleb could you add a test for this, please?

@kaleb
Copy link
Contributor Author

kaleb commented Aug 22, 2017 via email

@JounQin
Copy link
Contributor

JounQin commented Aug 29, 2017

I tried to add this code manually but TypeScript still throws error when using

new VueRouter({
  routes: [
    {
      path: '/',
      component: () => import('../views/Home.vue')
    }
  ]
})

@kaleb Have you used dynamic import for AsyncComponent successfully before?

@kaleb
Copy link
Contributor Author

kaleb commented Aug 29, 2017

@JounQin Yes... sorry, it has taken me a bit to get back to this. Just a minute, and I can look it up where I use it.

@kaleb
Copy link
Contributor Author

kaleb commented Aug 29, 2017

@kaleb
Copy link
Contributor Author

kaleb commented Aug 29, 2017

@JounQin You need to be using webpack for that specific syntax... I myself use SystemJS.

@kaleb
Copy link
Contributor Author

kaleb commented Aug 29, 2017

@posva Added test

@posva
Copy link
Member

posva commented Aug 29, 2017

halp @ktsn 🙏

@JounQin
Copy link
Contributor

JounQin commented Aug 30, 2017

@kaleb Of course I'm using dynamic import with webpack.
That's because dynamic import will resolve with default key.

https://github.com/JounQin/ts-study/blob/dynamic_import/src/router/index.ts

So maybe type of AsyncComponent or AsyncComponent as RouterComponent should be updated.

@ktsn
Copy link
Member

ktsn commented Aug 30, 2017

Oh, I see. I think we should update AsyncComponent type in core because resolving default is the core feature.
This PR looks good to merge for me.

@posva posva merged commit e69bc47 into vuejs:dev Aug 30, 2017
@JoweiBlog
Copy link

error

@ktsn
Copy link
Member

ktsn commented Sep 3, 2017

The PR was already made. vuejs/vue#6477

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.

5 participants