Is const assertion an option for you? You can set your constant as const
and you won’t have any type issues:
const cellDataFormater = {
string: (x: string) => x,
float: (x: number) => x,
int: (x: number) => x,
date: (x: string) => x,
boolean: (x: string) => x,
} as const;
cellDataFormater['string']('toto'); // ok
CLICK HERE to find out more related problems solutions.