MCPcopy
hub / github.com/Effect-TS/effect / transformLiteral

Function transformLiteral

packages/effect/src/Schema.ts:4013–4022  ·  view source on GitHub ↗
(
  from: Encoded,
  to: Type
)

Source from the content-addressed store, hash-verified

4011 * @since 3.10.0
4012 */
4013export function transformLiteral<Encoded extends AST.LiteralValue, Type extends AST.LiteralValue>(
4014 from: Encoded,
4015 to: Type
4016): transformLiteral<Type, Encoded> {
4017 return transform(Literal(from), Literal(to), {
4018 strict: true,
4019 decode: () => to,
4020 encode: () => from
4021 })
4022}
4023
4024/**
4025 * Creates a new `Schema` which maps between corresponding literal values.

Callers 1

transformLiteralsFunction · 0.70

Calls 2

transformInterface · 0.70
LiteralFunction · 0.70

Tested by

no test coverage detected