Y
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
seanmcdirmid
2327 days ago
Ya, I often have to write “this as any as T” because I’m using T as a self type.
link
nojvek
2327 days ago
That’s my understanding too. You just can’t cast types wily Nily.
link