Refining a Schema with Score Transformation in TypeScript
is there a better way than this to do a refinement based of an existing schema?
export const Score = S.Union(
S.Literal(1),
S.Literal(2),
S.Literal(3),
S.Literal(4),
S.Literal(5),
);
export const ScoreFromNumber = S.transform(S.Number, Score, {
encode: identity,
decode: identity,
strict: false,
});