News for hackers. Stuff that matters.
Re:Complete Rewrite of ESLint by nine_k on Monday November 28, 2022 @08:50AM (#33773616)
While I'm in favor of TS, I'm in favor of it for practical reasons.

Since the new ESLint is going to be highly modular, TS would shine in defining these modules' interfaces in a robust way. Whether to use TS deeper down, or whether to enforce the use of TS across the codebase, is another question. Prototyping is often easier and faster with plain JS, while typing well-defined parts later may be helpful for maintenance purposes.

Re:Complete Rewrite of ESLint by madeofpalk on Monday November 28, 2022 @09:41AM (#33774141)
> Prototyping is often easier and faster with plain JS

I disagree, especially in the realm of AST-crawling, that having type hints in the IDE has been extremely beneficial in moving fast.

Re:Complete Rewrite of ESLint by nine_k on Monday November 28, 2022 @10:28AM (#33774771)
I have very often seen prototype code crafted in a REPL, not in an IDE. That's where the fluidity comes in handy.

Type-level refactoring tools don't seem to be very powerful at the moment, too; without them, you can end up with some legwork when you change a design decision (a frequent thing while prototyping), even if you carefully aliased every type (which is legwork in its own right, because trivial cases like 2-tuples are plentiful).

Fortunately, TS allows you to gradually type your code, and rely on inference in many cases (not as much as Haskell, but still).

Re:Complete Rewrite of ESLint by jakear on Monday November 28, 2022 @12:01PM (#33776084)
What you want is a prototyping REPL, in your IDE, that gives you type hints, type aware autocomplete, and inline type errors, but knows to back the fuck off when you want to just run the code and perform simple type-stripping rather than erroring out and telling you to fix types or GTFO.

Bonus points if it comes in notebook form so you get a nice convenient run button, a solid multiline text editor, and markdown-powered persistence format.

Thankfully, this already exists: https://marketplace.visualstudio.com/items?itemName=jakearl.... . And it supports every language your shell does!

(I made it)

Re:Complete Rewrite of ESLint by Xelynega on Monday November 28, 2022 @10:32AM (#33774827)
Doesn't JSDoc(which the original post wants to use) also allow you to robustly define interfaces?
Re:Complete Rewrite of ESLint by graftak on Monday November 28, 2022 @11:21AM (#33775521)
Jsdoc has the same issue as regular comments. It’s not the source of truth but someone’s hopefully up to date version of the truth.
Re:Complete Rewrite of ESLint by runarberg on Monday November 28, 2022 @12:19PM (#33776349)
You’re wrong. TypeScript allows annotating types within JSDoc comments, and knows how to read it. Writing in JavaScript and using TypeScript as a type checker is a perfectly feasible option that many have picked (including this eslint rewrite).

https://www.typescriptlang.org/docs/handbook/jsdoc-supported...

Re:Complete Rewrite of ESLint by Xelynega on Sunday December 04, 2022 @06:28PM (#33859234)
AFAIK the only thing jsdoc "can't do" that typescript can is "generic types", which is just syntactic sugar for having a base type that all others inherit from.