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

Using typescript, I cannot access imported store in router.ts #1464

alexeigs opened this Issue Dec 5, 2018 · 1 comment


None yet
2 participants

alexeigs commented Dec 5, 2018

vue-cli 3.0 setup incl. Typescript

I try to access a getter through the store property from inside my router.ts which doesn't find anything and results in undefined. The imported store object doesn't work. Using the debugger, the reference to the store object at this point in time is something like _store_index__WEBPACK_IMPORTED_MODULE_5__ instead (going down the tree, I can find my getters under _store_index__WEBPACK_IMPORTED_MODULE_5__.default.getters).


import Vue from 'vue'
import Vuex, { StoreOptions } from 'vuex'


const store: StoreOptions<RootState> = {
    state: {
        version: '1.0.0' // a simple property
    modules: {

export default new Vuex.Store<RootState>(store)

export interface RootState {
    version: string


import Vue from 'vue'
import Router from 'vue-router'
import store from '@/store/index'

const router = new Router({
    mode: 'history',
    base: process.env.BASE_URL,
    routes: [{}]

router.beforeEach((to, from, next) => {
    if (store.getters.authModule.isUserLoggedIn) {
        // continue

Any idea what's wrong and how I could access the getters instead?


This comment has been minimized.

vue-issue-bot commented Dec 5, 2018

Hello, your issue has been closed because it does not conform to our issue requirements. In order to ensure every issue provides the necessary information for us to investigate, we require the use of the Issue Helper when creating new issues. Thank you!

@alexeigs alexeigs changed the title from Using typescript, I cannot access store property in router.ts to Using typescript, I cannot access imported store in router.ts Dec 5, 2018

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