When casting from a type A to a type B, the spec says that either A is assignable to B, or B is assignable to A. But the playground allows something more general: in some cases, as long as A and B have a common subtype, it doesn’t warn. The next example is valid.
functionf(x: number|string){return<number|boolean>(x);}The playground uses the comparable relation. The spec should be updated to include it.
When casting from a type A to a type B, the spec says that either A is assignable to B, or B is assignable to A. But the playground allows something more general: in some cases, as long as A and B have a common subtype, it doesn’t warn. The next example is valid.
The playground uses the comparable relation. The spec should be updated to include it.