Re:JavaScript is Good, Actually
by cprecioso on Wednesday May 16, 2018 @02:46AM
(#17080445)
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.
[ Parent
| on HN ]
> 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.