MCPcopy Create free account
hub / github.com/Effect-TS/effect / Literal

Function Literal

packages/effect/src/Schema.ts:2772–2783  ·  view source on GitHub ↗
(literal: L)

Source from the content-addressed store, hash-verified

2770 * @since 3.10.0
2771 */
2772export function Literal<L extends SchemaAST.LiteralValue>(literal: L): Literal<L> {
2773 const out = make<Literal<L>>(new SchemaAST.Literal(literal), {
2774 literal,
2775 transform<L2 extends SchemaAST.LiteralValue>(to: L2): decodeTo<Literal<L2>, Literal<L>> {
2776 return out.pipe(decodeTo(Literal(to), {
2777 decode: SchemaGetter.transform(() => to),
2778 encode: SchemaGetter.transform(() => literal)
2779 }))
2780 }
2781 })
2782 return out
2783}
2784
2785/**
2786 * Namespace for {@link TemplateLiteral} helper types.

Callers 8

transformFunction · 0.70
tagFunction · 0.70
Schema.tsFile · 0.70
OptionFunction · 0.70
ResultFunction · 0.70
RedactedFunction · 0.70
CauseReasonFunction · 0.70
ExitFunction · 0.70

Calls 1

makeFunction · 0.70

Tested by

no test coverage detected