I read that some people find the type erasure proposal not trustworthy as tools such as TypeScript and Flow have different type checking behavior and may also vary due to version upgrades.
If the proposal was taking the runtime types approach, possibly there could be a special treatment of complex types such as union and complement types, similiar to polymorphism:
Complex types are checked at compile time for correctness
Complex types are converted to any at runtime.
For example, consider the following program:
type U = "n1" | "n2";
const v: U = "nN";
The above program generates a compile time verify error. If it were valid, it'd translate to:
I read that some people find the type erasure proposal not trustworthy as tools such as TypeScript and Flow have different type checking behavior and may also vary due to version upgrades.
If the proposal was taking the runtime types approach, possibly there could be a special treatment of complex types such as union and complement types, similiar to polymorphism:
any
at runtime.For example, consider the following program:
The above program generates a compile time verify error. If it were valid, it'd translate to:
Complex types include: