Typescript throws an error with the following code:
type AndType<AstT> = { type: 'And', args: [AstT] };
type TrueType = { type: 'True' };
type BaseAST = AndType<BaseAST> | TrueType;
Complaining that Type alias 'BaseAST' circularly references itself.; however, if I wrap the circular reference in an object, the types compile fine:
type AndType<AstT> = { type: 'And', args: [AstT] };
type TrueType = { type: 'True' };
type BaseAST = {value: AndType<BaseAST>} | {value: TrueType};
Why? Does anyone have a reference to the docs where this behavior is defined?