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

A lot of apps would (or at least should) still want to strip types for bundle size reasons though.

To take one extreme example, a library I work on includes an API for calling a JSON RPC server. Instead of manually implementing each call, we use a proxy object that converts any method call on it to a JSON RPC call. Then layer on types so given an RPC object you know every method on it and have typed input params and output. This means you can have any number of methods without increasing your bundle size, because all the types disappear at runtime. It also means you can add your own methods if you’re talking to a server that implements custom ones by just defining types. If you shipped this to the browser with the types then it’d be a much bigger bundle than without them.



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

Search: