Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I agree that the writer shouldn't have used TypeScript to demonstrate JavaScript; but to be fair, the only thing you have to do to turn it into JS is remove the `as ConsignmentSetup` on the 4th line.


> the only thing you have to do to turn it into JS is remove the `as ConsignmentSetup`

Removing the cast means removing static typing. It might be a small change for this snippet, but at the project level, you'd need considerably more changes, and you'd lose type safety.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: