Hacker News new | ask | show | jobs
by alexcole 2327 days ago
Thats not 100% true in TypeScript. TypeScript actually only allows "up-casts" and "down-cast" (but if the type is neither a supertype nor a subtype the compiler will throw an error).
2 comments

Ya, I often have to write “this as any as T” because I’m using T as a self type.
That’s my understanding too. You just can’t cast types wily Nily.