Skip to content

How to declare returning type when calling defineStore #2518

Closed Answered by posva
nickeljew asked this question in Help and Questions
Discussion options

You must be logged in to vote

You don't, let Pinia infer the types for you. The only place you should put the types is at the level of the different properties:

defineStore('id', () => {
  const count = ref<number>(0) // <-- here
  return { count }
})

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@nickeljew
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