typescript interface for objects code example
Example 1: typescript interface
interface NumberOrStringDictionary {
[index: string]: number | string;
length: number; // ok, length is a number
name: string; // ok, name is a string
}Try
Example 2: create method in interface for set TS
running: someTask, arg: test