Live data from Hacker News

PR that converts the TypeScript repo from namespaces to modules

github.com

201–204 of 204 posts

Re: PR that converts the TypeScript repo from namespaces to modules

#201

Earlier quoted context omitted.

Because TSC isn't your bundler. It's job is different from a bundler. A bundler runs under the assumption that everything you import it has to find and handle. Typescript only needs to find a definition for an import. Typescript may have a complete view of a single project, in which case yes, it should know what file type it is emitting in that project , but then it has to track "in project" imports differently from…

I realise it’s not trivial, but it’s really hard to believe it’s that difficult! When I look at the multiple(!) issues on TS GitHub asking “please, can we just import .ts files with a .ts extension? That would make life a lot easier”, the comments from the developers pushing back on it aren’t about Node integration issues, they’re about the unshakable principle that TS must never rewrite syntactically valid JavaScrip…

> they’re about the unshakable principle that TS must never rewrite syntactically valid JavaScript at all.

Which is starting to be a very useful principle of Typescript. Typescript knows that today it is not your bundler and tries to leave almost all rewriting to your bundler. That leaves bundlers able to strip types without even needing a direct dependency on Typescript. This is why tools like swc and esbuild written entirely in other languages now type strip as well.

This is also why the Typescript team has been a proponent for a proposal to add type stripping (or something like it) to the entire web platform. (There's a Stage 1 proposal in TC-39's process.)

You may not find that useful, but there's a growing ecosystem around "Typescript is just for types, not also for deeper transpilation". It is not just TS developer being "high and mighty" in the face of things you think they could make the developer experience easier on.

Re: PR that converts the TypeScript repo from namespaces to modules

#202

Earlier quoted context omitted.

I realise it’s not trivial, but it’s really hard to believe it’s that difficult! When I look at the multiple(!) issues on TS GitHub asking “please, can we just import .ts files with a .ts extension? That would make life a lot easier”, the comments from the developers pushing back on it aren’t about Node integration issues, they’re about the unshakable principle that TS must never rewrite syntactically valid JavaScrip…

> they’re about the unshakable principle that TS must never rewrite syntactically valid JavaScript at all. Which is starting to be a very useful principle of Typescript. Typescript knows that today it is not your bundler and tries to leave almost all rewriting to your bundler. That leaves bundlers able to strip types without even needing a direct dependency on Typescript. This is why tools like swc and esbuild writte…

I think we’re violently agreeing?

If TypeScript isn’t the bundler, it shouldn’t complain (as it currently does) when you import a “.ts” file. It shouldn’t care at all!

Re: PR that converts the TypeScript repo from namespaces to modules

#203
post #137

Earlier quoted context omitted.

While that may be true, "spaces for alignment" is nigh unsupported by all editors I've seen. They insist on replacing 8 (or N) spaces with tab even if in an alignment region. int foobar(int a, ___________int b) // should only ever have spaces (using _ here because HTML) But good luck finding an editor that won't insert a tab when you use the tab key here (willing to be wrong). The other issue I have is that diffs bre…

With a .editorconfig[1] file with the correct configs you can get most code editors to insert spaces instead of tabs. [1] https://editorconfig.org/

What configuration is necessary for editors to insert spaces in code like this:

https://lore.kernel.org/keyrings/20221109025019.1855-2-linux...

If HN mangles the link, it is the addition of the `key_create` function in this thread: https://lore.kernel.org/keyrings/20221109025019.1855-2-linux...

Re: PR that converts the TypeScript repo from namespaces to modules

#204

Earlier quoted context omitted.

No, it's incredibly stupid and is missing the point. You use tabs to not be consistent. So that the crazy js person can have a 2-wide indent and the slightly visually impaired person can have an 8-wide indent without reformatting the entire codebase

Are you visually impaired of have you received or read criticisms of this nature from visually impaired persons? Genuine curiosity, because if this is a matter of accessibility I would vouch for tabs. Thing is that with spaces you can also predict consistently the line length and not have code being clipped on someone's screen that set tabs for 8 spaces for some reason. In any case, I like spaces but I am impartial t…

I've recieved.

But I'm also the crazy person who uses an 8 wide indent anyway

Post reply on HN