Typescript error accessing this
#1151
-
Anytime I try to access
I've followed the docs to the tee as far as I can see. Wondering what the solution to this is? Also, the docs could benefit from a Typescript section explaining various things. |
Beta Was this translation helpful? Give feedback.
Answered by
posva
Mar 16, 2022
Replies: 1 comment 2 replies
-
you need to use a normal function instead: getters: {
details(state) {
this.
}
} Arrow functions bind their context to the context they are defined at: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
posva
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you need to use a normal function instead:
Arrow functions bind their context to the context they are defined at: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions