Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
alexcole
· 6y ago · 0 comments
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).
Comments
[–]
seanmcdirmid
6y ago
Ya, I often have to write “this as any as T” because I’m using T as a self type.
[–]
nojvek
6y ago
That’s my understanding too. You just can’t cast types wily Nily.