Skip to content

Struggling with types for Getters #728

Oct 18, 2021 · 1 comments · 6 replies
Discussion options

You must be logged in to vote

You should type things by passing a generic to ref and computed:

const myValues = ref<MyValue[]>([]);
const myTruthyValues = computed<MyValue[]>(() => ...)

Note this is not specific to Pinia, it's more about TS and generics and the exposed types for the composition API

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@posva
Comment options

@jtuchel
Comment options

@posva
Comment options

@jtuchel
Comment options

@posva
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
2 participants