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

These kind of articles seem to be commonplace and I frankly do not think they provide any productive value. "any" is supposed to be the escape hatch as TypeScript is designed to be incremental. Anyone with a semblance of understanding knows that TypeScript transpiles into regular JavaScript, you don't run TypeScript code in the browser.


Friendly tips: you can replace any with unknown. Other friendly tips: runtime type checks are available https://github.com/gcanti/io-ts https://github.com/pelotom/runtypes


Can you please provide more detail when it's best to use runtime type checks? For webapps with strict TS config, I'm failing to see the advantage. Runtime errors can occur when crossing boundaries from server API to UI but when you discover the exceptions, you go fix your contract.


1st it's easier to identify which contract is inaccurate, or even whether the contract is inaccurate or not in the first place

2nd it's more convenient for both the end-user and the developers that errors are handled this way




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: