transformLiterals
Call Signature
Section titled “Call Signature”transformLiterals<
A>(…pairs):Union<{ -readonly [I in string | number | symbol]: transformLiteral<A[I<I>][1], A[I<I>][0]> }>
Defined in: node_modules/.pnpm/effect@3.15.2/node_modules/effect/dist/dts/Schema.d.ts:2073
Creates a new Schema which maps between corresponding literal values.
Type Parameters
Section titled “Type Parameters”A extends readonly [readonly [LiteralValue, LiteralValue], readonly [LiteralValue, LiteralValue], readonly [LiteralValue, LiteralValue]]
Parameters
Section titled “Parameters”…A
Returns
Section titled “Returns”Union<{ -readonly [I in string | number | symbol]: transformLiteral<A[I<I>][1], A[I<I>][0]> }>
Example
Section titled “Example”import * as assert from "node:assert"import * as S from "effect/Schema"
const Animal = S.transformLiterals( [0, "cat"], [1, "dog"], [2, "cow"])
assert.deepStrictEqual(S.decodeSync(Animal)(1), "dog")3.10.0
Call Signature
Section titled “Call Signature”transformLiterals<
Encoded,Type>(pairs):transformLiteral<Type,Encoded>
Defined in: node_modules/.pnpm/effect@3.15.2/node_modules/effect/dist/dts/Schema.d.ts:2076
Creates a new Schema which maps between corresponding literal values.
Type Parameters
Section titled “Type Parameters”Encoded
Section titled “Encoded”Encoded extends LiteralValue
Type extends LiteralValue
Parameters
Section titled “Parameters”[Encoded, Type]
Returns
Section titled “Returns”transformLiteral<Type, Encoded>
Example
Section titled “Example”import * as assert from "node:assert"import * as S from "effect/Schema"
const Animal = S.transformLiterals( [0, "cat"], [1, "dog"], [2, "cow"])
assert.deepStrictEqual(S.decodeSync(Animal)(1), "dog")3.10.0
Call Signature
Section titled “Call Signature”transformLiterals<
A>(…pairs):Schema<A[number][1],A[number][0]>
Defined in: node_modules/.pnpm/effect@3.15.2/node_modules/effect/dist/dts/Schema.d.ts:2077
Creates a new Schema which maps between corresponding literal values.
Type Parameters
Section titled “Type Parameters”A extends readonly readonly [LiteralValue, LiteralValue][]
Parameters
Section titled “Parameters”…A
Returns
Section titled “Returns”Schema<A[number][1], A[number][0]>
Example
Section titled “Example”import * as assert from "node:assert"import * as S from "effect/Schema"
const Animal = S.transformLiterals( [0, "cat"], [1, "dog"], [2, "cow"])
assert.deepStrictEqual(S.decodeSync(Animal)(1), "dog")3.10.0