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
* @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 {
let ret: ReturnType<A[typeof actionName]>
try {
ret = actions[actionName].apply(localStore, args as unknown as any[])
- Promise.resolve(ret)
- // @ts-expect-error: can't work this out
- .then(afterCallback)
- .catch(onErrorCallback)
+ Promise.resolve(ret).then(afterCallback).catch(onErrorCallback)
} catch (error) {
onErrorCallback(error)
throw error