type DigitValidator = (char) => boolean;

const numericValidator = (char) => /[-]{}/.test(char);

export const digitValidators: {[key: string]: DigitValidator} = {
'': numericValidator
};

We can use 'type' keyword to define a function type.

'digitValidators', is a mapping object, return a function which type is DigitValidator.

05-27 18:48