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

Property '$store' does not exist on type 'ComponentInternalInstance | CombinedVueInstance<Vue, object, object, object, Record<never, any>>' #64

Open
rafaelmagalhaes opened this issue Mar 31, 2022 · 3 comments

Comments

@rafaelmagalhaes
Copy link

rafaelmagalhaes commented Mar 31, 2022

Recently my test started failing with this error

  node_modules/vuex-composition-helpers/src/util.ts:104:9 - error TS2339: Property '$store' does not exist on type 'ComponentInternalInstance | CombinedVueInstance<Vue, object, object, object, Record<never, any>>'.

    104  const {$store} = 'proxy' in vm ? vm.proxy : vm;

I'm using this package version 1.1.0 with nuxtjs and nuxt-composition package

Node version: 14.17.5
NPM version: 6.14.15

Here's my jest config file

module.exports = {
  moduleNameMapper: {
    '^@/(.*)$': '<rootDir>/$1',
    '^~/(.*)$': '<rootDir>/$1',
    '^vue$': 'vue/dist/vue.common.js',
  },
  moduleFileExtensions: ['ts', 'js', 'vue', 'json', 'jsx', 'json'],
  transform: {
    '^.+\\.(ts|tsx)?$': 'ts-jest',
    '^.+\\.(js|jsx)$': 'babel-jest',
    '.*\\.(vue)$': 'vue-jest',
    '^.+\\.ts?$': 'ts-jest',
  },
  testMatch: ['<rootDir>/**/*.spec.js', '<rootDir>/**/*.spec.ts'],
  collectCoverageFrom: ['<rootDir>/components/**/*.vue', '<rootDir>/pages/**/*.vue', '**/*/*.ts'],
  coveragePathIgnorePatterns: ['/node_modules/', '/types/', '/proto/', '/.nuxt/'],
  setupFilesAfterEnv: ['./jest.setup.ts'],
  snapshotSerializers: ['jest-serializer-vue'],
  transformIgnorePatterns: ['<rootDir>/node_modules/(?!vuex-composition-helpers)'],
};

@davidmeirlevy
Copy link
Contributor

Can you try to locate where is the $store located in this version of nuxt?

@rafaelmagalhaes
Copy link
Author

Can you try to locate where is the $store located in this version of nuxt?

image

@rafaelmagalhaes
Copy link
Author

manage to solved it by doing this


// vuex-shims.d.ts

import { Store } from 'vuex';

declare module '@vue/composition-api' {
  interface ComponentInternalInstance {
    $store: Store<any>;
  }


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

No branches or pull requests

2 participants