I was wondering how to declare an array of typed functions in TypeScript.
For example, let's say I have a field that can contain a function that has no arguments and returns void:
private func: () => void;
Now, let's say I need a field that can contain an array of such functions:
private funcs: () => void [];
This is obviously the wrong way to do what I thought, as the compiler considers it to be a function that returns an array of voids.
Trying to isolate an inline prototype declaration with parentheses, as in:
private funcs2: ( () => void ) [];
causes a compiler error.
Does anyone have any idea how this can be done?
source share