News for hackers. Stuff that matters.
Re:A 10x Faster TypeScript by kaoD on Tuesday March 11, 2025 @10:50AM (#43333005)
To clarify why it's actually not that ambiguous: TS is not (and does not have) a runtime at all. Even TS-first runtimes like Deno are (1) not TS but its own thing and most importantly (2) just JS engines with a frontend layer that treats TS as a first-class citizen (in Deno's case, V8).

It's hard to tell if there will even be a runtime that somehow uses TS types to optimize even further (e.g. by proving that a function diverges) but to my knowledge they currently don't and I don't think there's any in the works (or if that's even possible while maintaining runtime soundness, considering you can "lie" to TS by casting to `unknown` and then back to any other type).

Re:A 10x Faster TypeScript by dec0dedab0de on Tuesday March 11, 2025 @12:09PM (#43333905)
“faster typescript” would also be a valid way to say the typescript compiler found a way to automatically write more performant javascript.

Just like if you said faster C++ that could mean the compiler runs faster, or the resulting machine code runs faster.

Just because the compile target is another human readable language doesn’t mean it ceases to be a typescript program.

I didn’t think this particular example was very ambiguous because a general 10x speed up in the resulting JS would be insane, and I have used typescript enough to wish the compiler was faster. Though if we’re being pedantic, which I enjoy doing sometimes, I would say it is ambiguous.

Re:A 10x Faster TypeScript by jakelazaroff on Tuesday March 11, 2025 @02:54PM (#43335817)
> “faster typescript” would also be a valid way to say the typescript compiler found a way to automatically write more performant javascript.

That still wouldn't make sense, in the same way that it wouldn't make sense to say "Python type hints found a way to automatically write more performant Python". With few exceptions, the TypeScript compiler doesn't have any runtime impact at all — it simply removes the type annotations, leaving behind valid JavaScript that already existed as source code. In fact, avoiding runtime impact is an explicit design goal of TypeScript [1].

They've even begun to chip away at the exceptions with the `erasableSyntaxOnly` flag [2], which disables features like enums that do emit code with runtime semantics.

[1] https://github.com/microsoft/TypeScript/wiki/TypeScript-Desi...

[2] https://www.typescriptlang.org/docs/handbook/release-notes/t...

Re:A 10x Faster TypeScript by jessekv on Tuesday March 11, 2025 @03:23PM (#43336092)
> Python type hints found a way to automatically write more performant Python

I get your point, but... this is exactly the premise of mypyc ;)

Re:A 10x Faster TypeScript by pcthrowaway on Wednesday March 12, 2025 @05:32AM (#43341296)
But typescript isn't a minifier or an optimizer. No part of typescript compiles it to anything that looks significantly different (besides enums).

Sure, lots of build tools do this, but that's not Typescript.

With very few exceptions, Typescript is written so that removing the Typescript-specific things makes it equivalent to the Javascript it transpiles to.

Re:A 10x Faster TypeScript by pzo on Tuesday March 11, 2025 @12:04PM (#43333845)
there is static hermes from Meta that do AoT compilation to native so I find it actually ambiguous. For a second I thought they did a compiler instead of transpile r.
Re:A 10x Faster TypeScript by pseudopersonal on Tuesday March 11, 2025 @11:05AM (#43333205)
Thanks for the clarification. For those of us who don't use TypeScript day to day, I feel that it is ambigious. Without clicking the link, you wouldn't know if it's about a compiler or a runtime. What if they announced a bun competitor?

https://betterstack.com/community/guides/scaling-nodejs/node....

Re:A 10x Faster TypeScript by fastball on Tuesday March 11, 2025 @11:40AM (#43333573)
Those are javascript runtimes, not TypeScript runtimes. The point stands.

If you don't know enough about TypeScript to understand that TypeScript is not a runtime, I'm not sure why you would care about TypeScript being faster (in either case).

Re:A 10x Faster TypeScript by zem on Tuesday March 11, 2025 @12:01PM (#43333804)
if typescript code execution got that much faster it might be a reason for someone to look into the language even if they knew nothing about it.
Re:A 10x Faster TypeScript by timeflex on Tuesday March 11, 2025 @03:14PM (#43336011)
There are plenty of other reasons to consider TypeScript, but again, what code execution are referring to? The V8 JavaScript engine?
Re:A 10x Faster TypeScript by zem on Tuesday March 11, 2025 @05:52PM (#43337459)
that's not the point I was making - gp was wondering why someone who didn't even know typescript compiled to javascript and ran atop a javascript engine would care that it had gotten 10x faster.
Re:A 10x Faster TypeScript by Izkata on Tuesday March 11, 2025 @07:38PM (#43338324)
I thought the title was announcing someone created a Typescript runtime. It is misleading.

Preact was "a faster React", for example.

Re:A 10x Faster TypeScript by alabastervlog on Tuesday March 11, 2025 @12:07PM (#43333883)
From the title, my initial assumption was someone wrote a compiler & runtime for typescript that doesn't target javascript, which was very exciting. And I do work with typescript.
Re:A 10x Faster TypeScript by internetter on Tuesday March 11, 2025 @11:20AM (#43333352)
> Without clicking the link, you wouldn't know if it's about a compiler or a runtime

I mean I think generally you’d want to click the link and read the article before commenting

Re:A 10x Faster TypeScript by depr on Tuesday March 11, 2025 @12:26PM (#43334112)
It has become a sport here to criticize titles for not explaining any random thing the commenter doesn't know. Generally these things are either in the article or they are very easily findable with a single web search.
Re:A 10x Faster TypeScript by jilles on Tuesday March 11, 2025 @11:25AM (#43333402)
If you have to explain why something is not ambiguous it is by definition ambiguous.
Re:A 10x Faster TypeScript by hoten on Tuesday March 11, 2025 @11:41AM (#43333586)
Maybe they aren't the audience. I don't see how this is ambiguous to anyone that actually uses typescript
Re:A 10x Faster TypeScript by 01HNNWZ0MV43FF on Tuesday March 11, 2025 @01:04PM (#43334638)
It was ambiguous to me. I've used TS a few times over the years, so I thought "native TypeScript compiler" meant AOT TS, not a TS compiler written in Go
Re:A 10x Faster TypeScript by owebmaster on Tuesday March 11, 2025 @01:38PM (#43335012)
deno runs typescript and it won't run 10x faster. It is ambiguous.
Re:A 10x Faster TypeScript by dwaltrip on Tuesday March 11, 2025 @07:34PM (#43338294)
It seems Deno compiles typescript to JS just like everyone else.

https://docs.deno.com/runtime/fundamentals/typescript/

Re:A 10x Faster TypeScript by totallykvothe on Tuesday March 11, 2025 @11:43AM (#43333608)
No. Ambiguous means that a statement has many possible meanings, not simply that something might be confusing.
Re:A 10x Faster TypeScript by jzackpete on Tuesday March 11, 2025 @11:59AM (#43333771)
that would imply the existence of an objective authority on the meaning of the statement, which is debatable
Re:A 10x Faster TypeScript by refulgentis on Tuesday March 11, 2025 @11:52AM (#43333705)
I'm a bit confused:

- It's not ambiguous because they mean $X.

- It is ambiguous because it has many possible meanings.

- It is not ambiguous because it has many possible meanings

Re:A 10x Faster TypeScript by maxloh on Tuesday March 11, 2025 @02:22PM (#43335503)
> It's hard to tell if there will even be a runtime that somehow uses TS types to optimize even further.

Yeah, that exists. AssemblyScript has an AOT compiler that generates binaries from statically typed code.

Re:A 10x Faster TypeScript by crabmusket on Tuesday March 11, 2025 @04:18PM (#43336585)
AssemblyScript is a very limited subset of the language though.
Re:A 10x Faster TypeScript by pas on Tuesday March 11, 2025 @07:16PM (#43338152)
I use TS a lot and still assumed they are embarking on a native runtime/compiler whatever epic journey.
Re:A 10x Faster TypeScript by xanth on Tuesday March 11, 2025 @07:44PM (#43338378)
Unfortunately many TS users have a surface level understanding of TS leading them to believe that TS is "real"
Re:A 10x Faster TypeScript by seanmcdirmid on Tuesday March 11, 2025 @08:27PM (#43338670)
> It's hard to tell if there will even be a runtime that somehow uses TS types to optimize even further

Typescript's type system is unsound so it probably will never be very useful for an optimizing compiler. That was never the point of TS however.