Is there a TypeScript equivalent of C#’s Func keyword?
On a preliminary exploration of TypeScript today converting some existing code, I used interface for classes/objects but found myself duplicating function types unnecessarily. Am I missing something?
In the following I’ve defined an interface for an object type (Data) and would benefit from naming (data: Data) => void too
interface Funcs {
box: (data: Data) => void;
lbl: (data: Data) => void;
}
Thanks!
A function type
(args) => tis just an abbreviation for the object type{(args): t}, so the following should work: