Live data from Hacker News

Functional Programming with TypeScript's Type System

desislav.dev

1–10 of 46 posts

Re: Functional Programming with TypeScript's Type System

#8
While no actual Turing machine’s tape is infinitely long, I found issues in TypeScript with how finite generics are.

You have to define every possible count of generic arguments if you want to preserve their types. And if you go above that count your type system degrades. I think there’s also a maximum of 7 or so before it doesn’t work. Beyond that and the generic type widens.

For example, Lodash enumerating types for 2 to 7 generic items per function: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0452...

Admittedly I don’t understand the problem space well. I’ve just seen it happen to me and in others’ code. It might not actually be an issue, or is already fixed.

Re: Functional Programming with TypeScript's Type System

#9

While no actual Turing machine’s tape is infinitely long, I found issues in TypeScript with how finite generics are. You have to define every possible count of generic arguments if you want to preserve their types. And if you go above that count your type system degrades. I think there’s also a maximum of 7 or so before it doesn’t work. Beyond that and the generic type widens. For example, Lodash enumerating types fo…

This was fixed in Typescript 4.0, with the introduction of variadic tuples: https://www.typescriptlang.org/docs/handbook/release-notes/t...
Post reply on HN