News for hackers. Stuff that matters.
Re:Deno will stop using TypeScript by mimixco on Sunday June 21, 2020 @11:51AM (#23592674)
I didn't read that types were causing problems. My understanding was TS, itself, was causing problems. Specifically waiting around for it to compile.

Strong typing is from OOPS, itself an optional programming methodology. There are many JS programs that simply access other (JSON) objects directly without going through an interface. In these instances, typing is counterproductive.

One of the beautiful things about JS (and Lisp) is that variables and functions are interchangeable and, the case of JS, both can be accessed directly without worrying about an interface.

Re:Deno will stop using TypeScript by jackjeff on Sunday June 21, 2020 @12:06PM (#23592792)
Just use Typescript static types where it is useful. If you access a bunch of JSON objects and you don’t need the typing, you can always declare as ‘any’ and move on.

At the end of the day those type exist in JavaScript. If you access ‘first_name’ instead of ‘firstname’ it will not work. The difference is that typescript would let you know before running the code instead of getting an obscure runtime error.

Re:Deno will stop using TypeScript by austincheney on Sunday June 21, 2020 @12:59PM (#23593289)
Deno is having problems with TypeScript, but TypeScript is not the cause of that problem. The problem is a self inflicted issue of a name collision of their choosing.
Re:Deno will stop using TypeScript by jorams on Sunday June 21, 2020 @01:11PM (#23593397)
Slow compile times are very much a problem caused by TypeScript.
Re:Deno will stop using TypeScript by austincheney on Sunday June 21, 2020 @02:17PM (#23593999)
You can do any manner of stupid things to make any compiler of any language to behave slowly, but that doesn’t mean all compilers are slow. If you want better output don’t deliver garbage for input.
Re:Deno will stop using TypeScript by eitland on Sunday June 21, 2020 @01:53PM (#23593768)
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?

Re:Deno will stop using TypeScript by austincheney on Sunday June 21, 2020 @02:26PM (#23594076)
It is something to do with a class in their code named something similar to header conflicting with a same named definition in their index.d.ts file that is closely related to that class instance.

If they dropped use of classes, or differentiated the names of the two things in collision the problem would appear to be solved.

To turn that around and blame TypeScript as the point of failure is an extremely bad omen suggesting their code style opinions are more important than product delivery. I could live with that nonsense if this were a framework or some minor dependency, which this application is not.

Re:Deno will stop using TypeScript by thomasrognon on Sunday June 21, 2020 @02:34PM (#23594144)
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> =
    T extends ImmutablePrimitive ? T :
    T extends [infer U]                                     ? readonly [Immutable<U>] :
    T extends [infer U, infer V]                            ? readonly [Immutable<U>, Immutable<V>] :
    T extends [infer U, infer V, infer X]                   ? readonly [Immutable<U>, Immutable<V>, Immutable<X>] :
    T extends [infer U, infer V, infer X, infer Y]          ? readonly [Immutable<U>, Immutable<V>, Immutable<X>, Immutable<Y>] :
    T extends [infer U, infer V, infer X, infer Y, infer Z] ? readonly [Immutable<U>, Immutable<V>, Immutable<X>, Immutable<Y>, Immutable<Z>] :
    T extends readonly [infer U]                                     ? readonly [Immutable<U>] :
    T extends readonly [infer U, infer V]                            ? readonly [Immutable<U>, Immutable<V>] :
    T extends readonly [infer U, infer V, infer X]                   ? readonly [Immutable<U>, Immutable<V>, Immutable<X>] :
    T extends readonly [infer U, infer V, infer X, infer Y]          ? readonly [Immutable<U>, Immutable<V>, Immutable<X>, Immutable<Y>] :
    T extends readonly [infer U, infer V, infer X, infer Y, infer Z] ? readonly [Immutable<U>, Immutable<V>, Immutable<X>, Immutable<Y>, Immutable<Z>] :
    T extends Array<infer U> ? ImmutableArray<U> :
    T extends ReadonlyArray<infer U> ? ImmutableArray<U> :
    T extends Map<infer K, infer V> ? ImmutableMap<K, V> :
    T extends ReadonlyMap<infer K, infer V> ? ImmutableMap<K, V> :
    T extends Set<infer M> ? ImmutableSet<M> :
    T extends ReadonlySet<infer M> ? ImmutableSet<M> :
    ImmutableObject<T>;
  type ImmutableArray<T> = ReadonlyArray<Immutable<T>>;
  type ImmutableMap<K, V> = ReadonlyMap<Immutable<K>, Immutable<V>>;
  type ImmutableSet<T> = ReadonlySet<Immutable<T>>;
  type ImmutableObject<T> = { readonly [K in keyof T]: Immutable<T[K]> };
Re:Deno will stop using TypeScript by tigershark on Sunday June 21, 2020 @01:32PM (#23593579)
No, it’s not counterproductive to access JSON objects using a predefined schema, it saves your ass in case of typos.