News for hackers. Stuff that matters.
Re:Aleph.js – Fullstack Framework in Deno by lucacasonato on Monday June 13, 2022 @03:00AM (#31722157)
It is. Deno runs TypeScript out of the box.
Re:Aleph.js – Fullstack Framework in Deno by abdusco on Monday June 13, 2022 @03:49AM (#31722470)
It strips type info and runs it as Javascript, though. There's no native typescript runtime, AFAIK (it doesn't enforce types at runtime, only at build time)
Re:Aleph.js – Fullstack Framework in Deno by croes on Monday June 13, 2022 @04:14AM (#31722653)
You do realize deno is based on the V8 JavaScript Engine and there isn't such thing as a typescript runtime even by Microsoft the developers of typescript?

https://en.wikipedia.org/wiki/TypeScript

Re:Aleph.js – Fullstack Framework in Deno by norman784 on Monday June 13, 2022 @05:35AM (#31723071)
Deno used to run the type checker with the `run` command, but now you need to pass a flag to run the type checker.
Re:Aleph.js – Fullstack Framework in Deno by nisegami on Monday June 13, 2022 @07:17AM (#31723818)
Sounds like that could be resolved with a simple alias in your shell?
Re:Aleph.js – Fullstack Framework in Deno by christophilus on Monday June 13, 2022 @05:50AM (#31723149)
And that’s a good decision. It lets you choose fast start times and run your type checker in your editor or a separate console, which is what I do in all of my Node applications.
Re:Aleph.js – Fullstack Framework in Deno by brundolf on Monday June 13, 2022 @11:44AM (#31727150)
This is different from what the GP is asking about, though
Re:Aleph.js – Fullstack Framework in Deno by MarquesMa on Monday June 13, 2022 @09:13AM (#31725076)
> It strips type info and runs it as Javascript, though. There's no native typescript runtime, AFAIK (it doesn't enforce types at runtime, only at build time)

Java strips type info and runs it as JVM byte codes. There's no native Java runtime, AFAIK(it doesn't enforce types at runtime, only at build time).

What's the problem?

Re:Aleph.js – Fullstack Framework in Deno by DerArzt on Monday June 13, 2022 @10:00AM (#31725686)
Just because something has been done before doesn't mean that it's a good thing.
Re:Aleph.js – Fullstack Framework in Deno by MarquesMa on Monday June 13, 2022 @10:54AM (#31726461)
I agree what you're saying, but they were talking about Python and TypeScript - it doesn't make sense to bring up type erasure in this context.
Re:Aleph.js – Fullstack Framework in Deno by djxfade on Monday June 13, 2022 @03:59AM (#31722538)
There is no such thing as a TypeScript runtime. TypeScript has always been a static typechecker
Re:Aleph.js – Fullstack Framework in Deno by eyelidlessness on Monday June 13, 2022 @11:54AM (#31727275)
You probably don’t want that throughout your entire codebase. It’s a lot of overhead. Where you do want it (at API/user input/network etc boundaries), you can use something like Zod[1] or similar to define your type guards and then infer the static types from there.

1: https://github.com/colinhacks/zod

Re:Aleph.js – Fullstack Framework in Deno by _greim_ on Monday June 13, 2022 @11:57AM (#31727312)
> There's no native typescript runtime.

A proposal was actually floated recently to grandfather in TypeScript-like annotations[1]. It would be ignored by the runtime and treated purely as a comment, and would be optional. This is what native runtime support for TypeScript would look like. Not sure if it will ever gain official support in the language though.

> it doesn't enforce types at runtime, only at build time

Runtime type "enforcement" is just your program breaking, for example "undefined is not a function". Well, I guess it isn't so simple, because JS does a lot of implicit type translation behind the scenes, like helpfully converting "123" to 123. It would be possible to "enforce" types at runtime by turning off that language feature in certain situations, but I don't think it will happen, for back-compat reasons.

[1] https://github.com/tc39/proposal-type-annotations

Re:Aleph.js – Fullstack Framework in Deno by norman784 on Monday June 13, 2022 @05:49AM (#31723147)
Im not sure why are you down voted, because your statement isn’t wrong, I’m not sure of Deno internals, but what GP said is also true, AFAIK is similar to run your TS app with ts-node but without the need to add a dependency, so it means that you just execute `deno run index.ts` and it worke, I’m not 100% sure but I think is also works with tsx/jsx files.
Re:Aleph.js – Fullstack Framework in Deno by lucideer on Monday June 13, 2022 @10:52AM (#31726434)
While the comment is technically accurate, it's:

(a) worded as a contradiction to the parent comment but isn't (it just talks about something unrelated - runtime typechecks). Deno does run typescript code out of the box, typechecks aside.

(b) the technical accuracy isn't particularly significant/relevant since in practice Deno has a simple switch to check types on run (though I'm not sure why you would want to do that outside of a development environment: Typescript is a static tool & doesn't have any dynamic capabilities that would change results based on runtime environment).

Re:Aleph.js – Fullstack Framework in Deno by rtpg on Monday June 13, 2022 @04:02AM (#31722567)
People say this all the time.

What does “enforced type system” mean to you? To my knowledge there is no language with a system that adds type checks (except in the case of checking a cast inside of a nominal type system).

Casts are such a tiny slice of code, and you can choose to not use them! It adds tedium, but none that would be missing in other languages.

Re:Aleph.js – Fullstack Framework in Deno by __alexs on Monday June 13, 2022 @05:18AM (#31722986)
Most languages intentionally avoid checking types at runtime except in specific situations where it's required (e.g. explicit typeof checks.) You do not want run time type checking on every variable access.
Re:Aleph.js – Fullstack Framework in Deno by skoskie on Monday June 13, 2022 @09:14AM (#31725087)
PHP has entered the chat.
Re:Aleph.js – Fullstack Framework in Deno by egeozcan on Monday June 13, 2022 @05:29AM (#31723048)
You can always use one of the million different runtime type-checking libraries at IO boundaries.