I would like to describe my object using type
. My object is recursive.
const value = {
name: 'one';
someKey: {
name: 'two'
};
}
const valu2 = {
name: 'one';
}
For my type I am getting an error:
type Foo = {
name: string;
[key: string]: Foo;
}
Property 'name' of type 'string' is not assignable to string index type 'Foo'.
What is wrong? I would like to use type
not interface
.