I'm trying to create a (generic) binary tree in TypeScript.
I've created an interface which looks like:
interface Node<T> {
(left?: T): Node<T>,
(right?: T): Node<T>,
(data: T): T
}
However, when I do this I get an error message which tells me that "all declarations of 'Node' must have identical type parameters.
Is it possible to create such structures in TypeScript or would I need to do this some other way?
An implementation made without generics appears to work fine.
interface Node {
left: Node,
right: Node,
data: any
}