Effect CommunityEC
Effect Community2y ago
43 replies
spaethnl

Pros and Cons of Static Encoders and Decoders in Classes

I like having decoders and encoders statically on the class for convenience. Is there any reason to not have something like this?
...
static fromUnknownSync = Schema.decodeUnknownSync(ThisClass)
static fromEncoded = Schema.decode(ThisClass)
...

or
...
static From = { 
...
  UnknownSync: Schema.decodeUnknownSync(ThisClass),
  Encoded: Schema.decode(ThisClass),
... 
}
...
Was this page helpful?