typescript value of interface code example
Example 1: typescript valueof interface
type ValueOf<T> = T[keyof T];
Example 2: typescript interface
interface Foo {
bar: string;
qux: number;
}
// Creates object implementing interface:
const MyFoo = <Foo> {
bar: "Hello",
qux: 7
}
// Or:
const MyFoo: Foo = {
bar: "Hello",
qux: 7
}