From e46f4b877687cab18377622dee2560e8fa295e39 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Thu, 3 Jun 2021 11:20:23 +0200 Subject: [PATCH] fix(types): fix extension for TS 4.3 --- src/mapHelpers.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mapHelpers.ts b/src/mapHelpers.ts index 165c7ec6..dd1d6c38 100644 --- a/src/mapHelpers.ts +++ b/src/mapHelpers.ts @@ -32,10 +32,13 @@ export type _StoreObject = 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 { -- 2.47.3