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

Support request: usage with Nuxt #8

Closed
pkej opened this issue Feb 14, 2018 · 2 comments
Closed

Support request: usage with Nuxt #8

pkej opened this issue Feb 14, 2018 · 2 comments

Comments

@pkej
Copy link

pkej commented Feb 14, 2018

From your documentation it seems this is a pattern, and as such I can't find any export I can use in a plugins context in nuxt.config.js, and since I'm just starting out With TypeScript I have no clue, except looking at code from different repositories, and Learning TypeScriptl

I hope you can advise on how to use it with Nuxt.

@sobolevn
Copy link

sobolevn commented Apr 14, 2018

The same here. Since I don't think that it is reasonable to use typescript without 100% type safety.
And I can clear see that vuex does not support typing out-of-the box.

Here's an example to demonstrate my point:

// store/index.ts

export const actions = {
  logoAction({ commit }, name: string) {
    commit('SET_LOGO', name)
  }
}

export const mutations = {
  SET_LOGO(state: State, data: string) {
    state.logo = data
  }
}

// pages/SomeComponent.vue

import Vue from 'vue'
import Logo from '~/components/Logo.vue'
import Component from 'nuxt-class-component'
import { Getter, Action } from 'vuex-class'

@Component({
  components: {
    Logo
  }
})
export default class extends Vue {
  @Getter('logo/logo') logo
  @Action('logo/logoAction') logoAction

  created () {
    this.logoAction(12) // no error here!!!
  }
}

@pkej have you found any solution?

@mrcrowl
Copy link
Owner

mrcrowl commented Oct 10, 2018

Sorry folks, I have no experience with nuxt, so can't comment here.

One option is to try and take this up with the author of vuex-type-safety. This guy forked from vuex-typex some time ago and may have an idea of how nuxt integrations could work.

@mrcrowl mrcrowl closed this as completed Oct 10, 2018
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

3 participants