Remix.run Logo
olmo23 6 hours ago

If you're already passing over the sources to strip the types, why would you also not do tree-shaking and minifications?

ZiiS 5 hours ago | parent [-]

Why would I want to strip my types?

wildpeaks 4 hours ago | parent | next [-]

Because it's a waste of bandwidth if they're not enforced at runtime, the same reason why minification exists.

ZiiS 4 hours ago | parent [-]

Both not minifying and including unenforced type hints consumes a little bandwidth though this can be largely offset by compression. This is an engineering trade off against the complexity of getting source maps working reliably for debugging and alerting. If I am shipping a video player or an internal company dashboard how much of my time is that bandwidth worth?

dminik 3 hours ago | parent | prev | next [-]

Maybe because TypeScript is not valid JavaScript (yet)? If you don't strip types, your code doesn't work.

wildpeaks 2 hours ago | parent [-]

It depends on the runtime: Node can run Typescript because it automatically strips types (which is so convenient during development).

But in browser, for now only the more limited JSDoc-style types can be shipped as-is indeed.

1dom 4 hours ago | parent | prev [-]

This feels like a ridiculous thread that captures everything wrong with modern Javascript ecosystem.

It's grown into a product of cults and attempted zingers rather than pragmatic or sensible technical discussions about what we should and shouldn't expect to be able to do with an individual programming language.

edit: to clarify, I assume there needs to be a basical level of comprehension of programming languages to debate the nuance of one, and if you can't think of a single reason as to why someone would want types removed, that's a possible indicator you don't have that necessary level yet, and I think the most effective way for you to learn that is to Google it. Sorry for coming across as rude if you genuinely don't know this stuff.

If you already know many reasons as to why types would be removed, then it seems disingenuous to ask that question, other than to make the point that you feel types shouldn't be stripped. If you think that, say it, and explain why you think they shouldn't be stripped.

ZiiS 4 hours ago | parent | next [-]

The current state of Javascript is you _have_ to remove types; I was pointing out I can think of reasons why I sometimes wouldn't want to. (Admittedly in a glib manor; though on this site many prefer that to four paragraphs)

pestatije 4 hours ago | parent | prev [-]

How goes that saying?... always assume ignorance or malice will getcha