Skip to content

Commit

Permalink
test: add type test for an options store that returns custom ref with…
Browse files Browse the repository at this point in the history
…in the state function
  • Loading branch information
nkeyy0 committed Mar 29, 2024
1 parent b9d7c0f commit 1f9939c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/pinia/test-dts/customizations.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,23 @@ expectType<{
})()
)
)

expectType<{
n: Ref<number>
customN: Ref<number> & { plusOne: () => void }
double: ComputedRef<number>
myState: Ref<number>
stateOnly: Ref<number>
}>(
storeToRefs(
defineStore('a', {
state: () => ({
n: 1,
customN: ref(1) as Ref<number> & { plusOne: () => void },
}),
getters: {
double: (state) => state.n * 2,
},
})()
)
)

0 comments on commit 1f9939c

Please sign in to comment.