]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
fix(types): fix extension for TS 4.3
authorEduardo San Martin Morote <posva13@gmail.com>
Thu, 3 Jun 2021 09:20:23 +0000 (11:20 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Thu, 3 Jun 2021 09:21:33 +0000 (11:21 +0200)
src/mapHelpers.ts

index 165c7ec695a194dd4f151c7b8e6980228cd8d798..dd1d6c38fef3a9d9c923302bed72aa6fe7c97f9e 100644 (file)
@@ -32,10 +32,13 @@ export type _StoreObject<S> = S extends StoreDefinition<
   infer Actions
 >
   ? {
-      [Id in `${Ids}${'suffix' extends keyof MapStoresCustomization
+      [Id in `${Ids}${MapStoresCustomization extends Record<'suffix', string>
         ? MapStoresCustomization['suffix']
         : 'Store'}`]: () => Store<
-        Id extends `${infer RealId}${'suffix' extends keyof MapStoresCustomization
+        Id extends `${infer RealId}${MapStoresCustomization extends Record<
+          'suffix',
+          string
+        >
           ? MapStoresCustomization['suffix']
           : 'Store'}`
           ? RealId
@@ -79,7 +82,7 @@ export let mapStoreSuffix = 'Store'
  * @param suffix - new suffix
  */
 export function setMapStoreSuffix(
-  suffix: 'suffix' extends keyof MapStoresCustomization
+  suffix: MapStoresCustomization extends Record<'suffix', string>
     ? MapStoresCustomization['suffix']
     : string // could be 'Store' but that would be annoying for JS
 ): void {