Effect CommunityEC
Effect Community2y ago
6 replies
sign error

Converting Uint8Array to Literal Type in Schema

Hey There! I am trying to create Schema that goes from Uint8Array to Literal. I have already created one that goes from Uint8Array to
string
and the composition looks like that:

const LiteralFromBytes = <A extends string>(byteLength: number, l: string) => pipe(
  StringFromBytes(byteLength),
  S.compose(S.Literal(l))
)


Unfortunately the resulting Schema still goes from Uint8Array to
string
instead of the literal value. Is there any way to handle that?
Was this page helpful?