]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
test: add more context tests
authorEduardo San Martin Morote <posva13@gmail.com>
Fri, 9 Apr 2021 18:36:22 +0000 (20:36 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Fri, 9 Apr 2021 18:36:22 +0000 (20:36 +0200)
test-dts/store.test-d.ts

index 5350092be18e3ba28f815f1728a882614034add9..e1a02adfd0123d3180d50a38fe7bee6cd6cc1fb4 100644 (file)
@@ -5,8 +5,22 @@ const useStore = defineStore({
   state: () => ({ a: 'on' as 'on' | 'off', nested: { counter: 0 } }),
   getters: {
     upper() {
+      expectType<'on' | 'off'>(this.a)
       return this.a.toUpperCase()
     },
+    other() {
+      expectType<string>(this.upper)
+      return false
+    },
+  },
+  actions: {
+    doStuff() {
+      expectType<string>(this.upper)
+      expectType<false>(this.other)
+    },
+    otherOne() {
+      expectType<() => void>(this.doStuff)
+    },
   },
 })