define function with interface in typescript code example
Example: 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
}