Answers for "typescript create new object from interface"

1

typescript create new object from 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
}
Posted by: Guest on April-29-2021

Code answers related to "typescript create new object from interface"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language