Skip to content

Q: eslint: Missing return type on function (ModuleActionContext) #29

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

Closed
viT-1 opened this issue Jan 22, 2020 · 7 comments
Closed

Q: eslint: Missing return type on function (ModuleActionContext) #29

viT-1 opened this issue Jan 22, 2020 · 7 comments
Labels
question Further information is requested

Comments

@viT-1
Copy link

viT-1 commented Jan 22, 2020

https://github.com/paleo/direct-vuex#in-a-vuex-module
const mod1ActionContext = (context: any) => moduleActionContext(context, mod1)

  • Can be context typed (not any)?
  • Which type of parameters <R,O> should be in DirectActionContext here?
const mod1ActionContext = (context: any):
DirectActionContext<R, O> => moduleActionContext(context, mod1)
@paleo
Copy link
Collaborator

paleo commented Jan 22, 2020

This context parameter is of type ActionContext<S, R> (from Vuex) but it is not important. We don't use it.

@viT-1
Copy link
Author

viT-1 commented Jan 22, 2020

I don't want to have eslint warnings about returned type of mod1ActionContext

@paleo
Copy link
Collaborator

paleo commented Jan 22, 2020

In DirectActionContext<R, O>, R is the type of the root store object, O is the type of the vuex module object.

@paleo paleo added the question Further information is requested label Feb 2, 2020
@paleo
Copy link
Collaborator

paleo commented Feb 14, 2020

I guess we can close this issue?

@viT-1
Copy link
Author

viT-1 commented Feb 14, 2020

@paleo I don't understand which code should be in my usecase:

const getTypedContext = (ctx: any) => moduleActionContext(ctx, modSomeForm);

@paleo
Copy link
Collaborator

paleo commented Feb 14, 2020

Maybe something like:

const getTypedContext = (ctx: any) => moduleActionContext(ctx, modSomeForm) as DirectActionContext<never, typeof modSomeForm>;

But I guess that useless rules from the linter should just be disabled.

@viT-1
Copy link
Author

viT-1 commented Feb 14, 2020

@paleo Typescript declarations are not useless =))

@viT-1 viT-1 closed this as completed Feb 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants