effect icon indicating copy to clipboard operation
effect copied to clipboard

Get combinator to access (nested) properties of a struct

Open florianbepunkt opened this issue 2 years ago • 0 comments

What is the problem this feature would solve?

const A = S.struct({
  b: S.string,
  c: S.struct({ d: S.boolean })
});

const B = A.pipe(S.get("b")); // S.Schema<string, string>
const D = A.pipe(S.get("c.d")); // S.Schema<boolean, boolean>

What is the feature you are proposing to solve the problem?

A new combinator that allows to get parts of a schema.

What alternatives have you considered?

Declaring parts of my schema that I want to reuse explicitly. But often this only adds syntactic noise.

florianbepunkt avatar Nov 14 '23 17:11 florianbepunkt