News for hackers. Stuff that matters.
Re:TIL: `satisfies` is my favorite TypeScript keyword by samdoesnothing on Sunday November 23, 2025 @01:14AM (#46021226)
You can encode that "correctly" in pure JS

   class LoadingState extends State {}
   class ResultState extends State {}
   class ErrorState extends State {}
   const state: State = new LoadingState
Generally it's a bad pattern to have dependant fields like your example, but you don't need TS to solve it.
Re:TIL: `satisfies` is my favorite TypeScript keyword by rtz121 on Sunday November 23, 2025 @08:04AM (#46023245)
Thats OOP, we don't do that anymore!!! /s
Re:TIL: `satisfies` is my favorite TypeScript keyword by epolanski on Sunday November 23, 2025 @08:36AM (#46023467)
Of course you can do it in JS too.

But you can't reason on the different cases aided by the type checker.

Also, using classes or POJOs is merely an implementation detail.