Skip to content
Discussion options

You must be logged in to vote

You need to explicitly type the getter if it uses this. See the example at https://pinia.esm.dev/core-concepts/getters.html

getters: {
 currentUser(): UserData {
     return this.user.data?.user;
 },
// or don't use `this` if possible
currentUser(state) {
     return state.user.data?.user;
 },
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Oleksii14
Comment options

@abhianshu2020
Comment options

Answer selected by posva
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants