function on interface typescript 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: interface ts one valu
// use type instead interface
type StringOrNull = string | null;