]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
fix(types): support for Vue 2.7
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 20 Jan 2025 08:16:53 +0000 (09:16 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 20 Jan 2025 08:16:53 +0000 (09:16 +0100)
packages/pinia/src/types.ts

index 4ca20da9e3dcc2120ccc9576bec228ce923d93eb..085bb39fb53c70b41838ce0a9cd88bd014927b09 100644 (file)
@@ -474,7 +474,9 @@ export type _StoreWithGetters_Writable<G> = {
     ? K
     : // NOTE: there is still no way to have a different type for a setter and a getter in TS with dynamic keys
       // https://github.com/microsoft/TypeScript/issues/43826
-      never]: G[K] extends WritableComputedRef<infer R, infer _S> ? R : never
+      // NOTE: to support Vue 2.7, we need to use Readonly and not infer the second type param
+      // https://github.com/vuejs/pinia/issues/2767#issuecomment-2601284366
+      never]: G[K] extends Readonly<WritableComputedRef<infer R>> ? R : never
 }
 
 /**