-
-
Notifications
You must be signed in to change notification settings - Fork 27
docs: How to use other modules? #66
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
Comments
@NaClyxp My apologies for the delayed response. Typescript 3.7 has brought some limitations on type inference. Specifically, there is now an issue with an accessor type used in the same module that exports it (thus, it only affects So I would amend your code as follows: export const accessorType = getAccessorType({
// actions,
getters,
mutations,
state,
modules: { user }
}) It's not optimal, but unfortunately it seems to be required at the moment. |
I've got 2 submodules: When I call a function from While commenting out What are my options here? Thanks! |
Sorry for the ping. Is there a potential workaround? Because right now, I'm not able to use any of the type definitions, as I'm ignoring the error via |
@tre-dev Apologies. It's a real pain, and is a change that began with TypeScript 3.7 that I've not been able to chase down. Here's a workaround: import { actionTree, useAccessor } from 'nuxt-typed-vuex'
import * as siblingPattern from '~/store/sibling'
export const state = () => ({
test: '',
})
export const actions = actionTree(
{ state },
{
initialise() {
const sibling = useAccessor(
this.app.$store,
siblingPattern,
'sibling'
)
sibling.runMySiblingAction()
},
}
) |
Thanks for the quick reply!
|
@tre-dev Sorry, forgot one thing - and you're quite right about It should be: const sibling = useAccessor(
this.app.store,
{ ...siblingPattern, namespaced: true },
'submodule'
) The |
Sorry, thought I'd answered already. That worked perfectly! |
When will this issue be completely fixed? |
any update on this? |
I've left this open to remind me to add something to the docs, rather than because I am hoping to change the behaviour of this module. As far as I'm aware, it's not an issue I can fix; it's to do with TypeScript wanting to avoid circular references. The best solution is from @shindex - annotate return type on actions/getters, etc. that you wish to reference circularly. |
Any example to use with nuxt/auth module? |
@MrJmpl3 Could you explain a little more what you mean? |
Sorry, a type, I mean to auth module of Nuxtjs, https://auth.nuxtjs.org/ , because when use this module, the auth plugin don't register the namespace for auth. |
@MrJmpl3 Ah, I see. Could you open a new issue for that - and maybe provide a reproduction? 🙃 |
How to use other modules?
The text was updated successfully, but these errors were encountered: