Open SRachamim opened 3 years ago
Class-based approached was abandoned in previous versions of fp-ts
because of limitations of js
/ts
.
@SRachamim I usually use classes as members of ADTs as you described and I am not aware of any limitation.
The class-based approach in reference above from which fp-ts migrated away refers to fluent APIs that are indeed very problematic.
📖 Documentation
In the documentation there's a suggestion on how to implement ADTs with TypeScript:
I wonder why can't we use
class
es instead? They come with a constructor for free:What can go wrong and what are the limitations of this approach?