Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

docs: there some issue with vuex store doc #556

@hotrungnhan

Description

@hotrungnhan

📚 Is your documentation request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I feel I should be able to [...] but I can't see how to do it from the docs.
i find out a little issue with vuex store.
"userStore" interface is so diferent with vuex interface "userStore" which is

/// from vuex
useStore<S = any>(injectKey?: InjectionKey<Store<S>> | string): Store<S>;
/// from composition-api
useStore<S = any>(injectKey?: InjectionKey<S> | string): Store<S>;

So there will caught you have to import like

export const key: InjectionKey<State> = Symbol()
//instead of 
import {Store} from 'vuex'
export const key: InjectionKey<Store<State>> = Symbol()

what ever it a feature or a bug , you might need to update new document for this
🔍 Where should you find it?
What page of the docs do you expect this information to be found on?

//https://composition-api.nuxtjs.org/packages/store/
import { defineComponent, useStore } from '@nuxtjs/composition-api'

export interface State {
  count: number
}

export const key: InjectionKey<Store<State>> = Symbol()

export default defineComponent({
  setup() {
    const store = useStore(key)
    const store = useStore<State>()
    // In both of these cases, store.state.count will be typed as a number
  },
})

ℹ️ Additional context
Add any other context or information.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions