question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use with vue-class-component?

See original GitHub issue

I’m trying to do something like that:

import foo from 'store/modules/foo';

@Component({
  methods: foo.mapMutations(['bar', 'baz'])
})

But got an error: Argument types do not match parameters on mapMutations.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
ktsncommented, Mar 13, 2019
  • TypeScript does not infer this type of component from component options of decorator. So it is actually normal to produce error like setTest does not exist.
  • If you want it to infer this type, you should use Vue.extend for mappers and inherit it.
import { Component, Vue } from 'vue-property-decorator';
import TestStore from './module';

const Super = Vue.extend({
  methods: TestStore.mapMutations(['setTest'])
})

@Component
export default class App extends Super {
  mounted() {
    this.setTest(true);
  }
}
0reactions
NikitaKAcommented, Mar 13, 2019

Yes, you were right - there is error, types working. It seems that WebStorm can’t recognize that… Sorry for bother you, thanks for help!

UPDATE Jetbrains support recommended me to install 2019.1 EAP (which adding better Typescript support in .vue files) and all errors are gone!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue Class Component: Overview
Vue Class Component is a library that lets you make your Vue components in class-style syntax. For example, below is a simple counter...
Read more >
You should be using Vue Class Component
To create a project using Vue Class Component from scratch, you just need to follow Vue CLI steps, make sure to manually select...
Read more >
How To Write Class-Based Components with Vue.js and ...
Step 1 — Setting Up the Project · Step 2 — Writing a Single-File Component with TypeScript · Step 3 — Using Component...
Read more >
vue-class-component examples - CodeSandbox
Vue Class Component Examples. Learn how to use vue-class-component by viewing and forking example apps that make use of vue-class-component on CodeSandbox.
Read more >
How to use TypeScript to Create Vue Apps with Vue Class ...
Introducing Vue Class Based Components ... We can start using class-based components by creating a project with the Vue CLI. ... In the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found