Is it possible to model a simple recursive relationship like the following? I want to restrict the types of values added to a generic container to primitives or other containers. Since interfaces can't extend from types, and types cannot reference themselves, it's not immediately clear whether this is possible:
type Primitive = string | boolean | number | null;
type Value = Primitive | MyMap<Value>; // <-- error here
interface MyMap<T extends Value> {
get(k: string): T;
set(k: string, v: T): void;
}