Live data from Hacker News

Deno will stop using TypeScript

startfunction.com

201–210 of 359 posts

Re: Deno will stop using TypeScript

#201
post #133

Earlier quoted context omitted.

Slow compile times are very much a problem caused by TypeScript.

My 3 year old laptop has no problems with TypeScript (neither Angular nor React), and I am a rather impatient guy when it comes to computers. I'm honestly wondering: What are people doing to end up in a position where TypeScript compile times are a problem?

My compile time went from seconds to minutes when I made a recursive immutable type (which I reverted of course). Overall, I still love typescript.

Edit for the curious, here's the monster type that caused such pathological build times...

  type ImmutablePrimitive = undefined | null | boolean | string | number | Function;
  export type Immutable =
    T extends ImmutablePrimitive ? T :
    T extends [infer U]                                     ? readonly [Immutable] :
    T extends [infer U, infer V]                            ? readonly [Immutable, Immutable] :
    T extends [infer U, infer V, infer X]                   ? readonly [Immutable, Immutable, Immutable] :
    T extends [infer U, infer V, infer X, infer Y]          ? readonly [Immutable, Immutable, Immutable, Immutable] :
    T extends [infer U, infer V, infer X, infer Y, infer Z] ? readonly [Immutable, Immutable, Immutable, Immutable, Immutable] :
    T extends readonly [infer U]                                     ? readonly [Immutable] :
    T extends readonly [infer U, infer V]                            ? readonly [Immutable, Immutable] :
    T extends readonly [infer U, infer V, infer X]                   ? readonly [Immutable, Immutable, Immutable] :
    T extends readonly [infer U, infer V, infer X, infer Y]          ? readonly [Immutable, Immutable, Immutable, Immutable] :
    T extends readonly [infer U, infer V, infer X, infer Y, infer Z] ? readonly [Immutable, Immutable, Immutable, Immutable, Immutable] :
    T extends Array ? ImmutableArray :
    T extends ReadonlyArray ? ImmutableArray :
    T extends Map ? ImmutableMap :
    T extends ReadonlyMap ? ImmutableMap :
    T extends Set ? ImmutableSet :
    T extends ReadonlySet ? ImmutableSet :
    ImmutableObject;
  type ImmutableArray = ReadonlyArray>;
  type ImmutableMap = ReadonlyMap, Immutable>;
  type ImmutableSet = ReadonlySet>;
  type ImmutableObject = { readonly [K in keyof T]: Immutable };

Re: Deno will stop using TypeScript

#202

Earlier quoted context omitted.

JS has zero unique set of feature. There is not a single feature in JS you can't find elsewhere, often better implemented. If anything, the vast majority of scripting languages (Python, Ruby, PHP...) have more features than JS. JS is so lacking in features that half of its ecosystem is dedicated to compensate for that (typescript, babel, webpack, undersacore...).

Sure and julia has the best matrices, python has the most flexible threading models, erlang has the best distributed runtime.. Yet one feature does not a language make. A language is the whole of it's behavior, and JS is a perfectly fine solution with a wide mix of good features. Is it the fastest? No. The most performant? Not close. Does it have the best ability to write language parsers? No! But it's not supposed t…

You're missing the point here, which is not that each of these languages has something JS does, it's that Perl, Python, Ruby etc all support all the same features, have large ecosystems of modules, are easy to use, etc.

JS is a fine language. It doesn't really bring anything new/different to the table (other than prototype inheritance, but that doesn't amount to much IMO), so the real differentiating factor is that it has a privileged position because of browsers.

Re: Deno will stop using TypeScript

#203
post #43
post #19

Earlier quoted context omitted.

there's plenty of huge software projects in dynamically typed languages. There are also huge classes of bugs that exist in these projects that a statically typed language completely eliminates! If they're running into trouble from having to have types, it's almost certainly design and architecture issue and does not make me think that deno is going to be a solid project.

For dynamically typed languages, the idea is you make up for that class of bugs by incorporating TDD and having lots and lots of unit tests. So, instead of waiting a minute for the typescript compiler, you wait for the engineer to write tests.

> you wait for the engineer to write tests

Which, if we're doing TDD, involves no waiting at all, since it was already written before the implementation. Ideally anyway.

Re: Deno will stop using TypeScript

#204
post #43

Earlier quoted context omitted.

For dynamically typed languages, the idea is you make up for that class of bugs by incorporating TDD and having lots and lots of unit tests. So, instead of waiting a minute for the typescript compiler, you wait for the engineer to write tests.

and you wait a minute for the tests to run every time you commit a change

If your application has any structure at all, you can often just run the tests for the part you're changing while you're working and committing locally. Once you're ready to push it you should probably run all the tests first even if your language has static types.

Re: Deno will stop using TypeScript

#205
post #5

> While TypeScript is sometimes seen as an improved version of JavaScript, this case is showing that in fact, it’s not. Woah, woah, hold on. This case is showing that in the very specific, atypical case the Deno team are using it in, TypeScript is not the right fit. I’d rather read something that actually interviews the Deno folks about what they are doing, the underlying document is a pretty free ranging discussion…

May as well drop tests and code reviews if it feels like it's slowing you down. For one-person or very small teams who have full context of a'll changes this can actually work very well. It's with more contributors participating in a mature project that you'd wish these things weren't dropped. Types can be added later so it's not like using php and later wishing you'd used Kotlin.

I'll add a datapoint of an analogous case. I updated a legacy java 1.x codebase that was running java 6/7 without generics. Having spent a small amount of effort over a course of months, all the type annotations were updated. It uncovered exactly one bug. The main improvement is for quickly gaining context in unfamiliar code and being able to enable warnings for newly written code without noisy error messages.

Re: Deno will stop using TypeScript

#206

I'm a little shocked at some of the outcry in this thread. People are making it sound like they're switching from Rust to Ruby or extolling the virtues of types: TypeScript does absolutely nothing for you at runtime. There are no types, there are no type checks, its all the same guarantees as good ol' JavaScript. You still can't trust function parameters to be what they say. It's a Babel configuration with inline doc…

Because runtime type checking is expensive. If most of your project is in TS then you will never hit type errors in runtime (we are yet to see after two years of development).

I have been using GWT, too hard to use comparing to typescript with pretty much same benefits.

Re: Deno will stop using TypeScript

#207
post #154

Due respect, these are issues with how the Deno team uses Typescript, not with the language itself. > TypeScript compile time when changing files takes several minutes, making continuous compiling an excruciatingly slow process Umm, you can compile single files, and serve them individually. It's no different from bundling (e.g. with webpack) Javascript. > The Typescript structure that they’re using in the source file…

Your main point seems to be that these problems aren’t the language’s fault. But I don’t see the Deno team claiming that to be the case. There’s nothing wrong with choosing a language that works with how your team likes to develop software, and rejecting a language that doesn’t work well for your team. Doesn’t need to be anyone’s “fault.”

That's true, but I think when you choose to use a programming language, you essentially commit to doing things its way, otherwise you end up dealing with lots of friction and having to reinvent a lot of wheels. Like the Deno team claim they do.

Taking up Typescript then ignoring best practices when trying to use it is unfortunate. This kind of thing would be a teaching moment for a junior engineer.

It's like saying you don't want to use a dishwasher because if you stack bowls on top of each other, it doesn't clean them well. Well, a dishwasher has its faults - a lot of dishes are not dishwasher-safe, etc. - but your reason kind of misses the point.

Re: Deno will stop using TypeScript

#209

Earlier quoted context omitted.

> Easy to reason about, I'd like to know what language you use as a baseline for this? I made my first "real" Javascript code back in 2005 (a vector map system that worked in realtime) and I've been working mostly with frontend for the last 3 years so it is not lack of familiarity. In between that however I have programmed a lot of other languages, worked in a number of different teams, written new code, maintained o…

Event threading pulls out a huge amount of difficulty with semaphores, locks, thread safety, etc. The lack of OO means no typecasting, inheritance models, interfaces, etc. Arrays are fully dynamic, not type restricted and operate strictly by reference. No memory mapping, manual garbage collection or even GC adjustments. Suddenly the list of things someone has to understand to be a competent JS engineer is way smaller…

Have my upvote for the serious answer. Let's just say we have different opinions.

Here's my attempt to create something similar from my perspective:

- Being able to know to at any point what a variable can contain is very liberating. (Ok, you can define a list of Object that behaves just like a list in JS: "fully dynamic, not type restricted", but thankfully for people like me that is not common in Java anymore.)

- Knowing that the compiler has my back allows me to work faster.

- My preferred languages (Java, C#, TypeScript) together with version control allows me to refactor fearlessly.

Re: Deno will stop using TypeScript

#210
post #75

Earlier quoted context omitted.

10K is a lot of code. As a maintainer of a popular 3k LOC typescript library, even at 1k LOC you start running into frequent type-related bugs with JavaScript

Working on half a million LOC TypeScript codebase. All strict flags up, low-2-digit team size. We don't really run into many problems. TypeScript is not perfect, but developer happiness and productivity have definitely increased since we adopted it, and defect rates have dropped significantly --while increasing the size of the team & working on more features.

I have a hard time believing that. We have 10k lines of typescript and that take forever to compile compared to 5x more of the ReasonML code we have that compiles instantly
Post reply on HN