Schema.Struct<{
readonly _tag: Schema.tag<"Literal">
readonly annotations: Schema.optional<
Schema.decodeTo<
Schema.$Record<Schema.String, Schema.Unknown>,
Schema.$Record<
Schema.String,
Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>
>,
never,
never
>
>
readonly literal: Schema.Union<
readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.BigInt]
>
}>Schema for the Literal representation node.
schemasLiteral
Source effect/SchemaRepresentation.ts:12175 lines
export const const $Literal: Schema.Struct<{
readonly _tag: Schema.tag<"Literal">
readonly annotations: Schema.optional<
Schema.decodeTo<
Schema.$Record<
Schema.String,
Schema.Unknown
>,
Schema.$Record<
Schema.String,
Schema.Codec<
PrimitiveTree,
PrimitiveTree,
never,
never
>
>,
never,
never
>
>
readonly literal: Schema.Union<
readonly [
Schema.String,
Schema.Finite,
Schema.Boolean,
Schema.BigInt
]
>
}>
const $Literal: {
Type: Struct.Type<Fields>;
Encoded: Struct.Encoded<Fields>;
DecodingServices: Struct.DecodingServices<Fields>;
EncodingServices: Struct.EncodingServices<Fields>;
Iso: Struct.Iso<Fields>;
fields: Fields;
mapFields: (f: (fields: { readonly _tag: Schema.tag<'Literal'>; readonly annotations: Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never…;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<{ readonly _tag: 'Literal'; readonly literal: string | number | bigint | boolean; readonly annotations?: { readonly [x: string]: unknown; } | undefined; }, readonly []>) => Schema.Struct<{ readonly _…;
annotateKey: (annotations: Schema.Annotations.Key<{ readonly _tag: 'Literal'; readonly literal: string | number | bigint | boolean; readonly annotations?: { readonly [x: string]: unknown } | undefined }>) => Schema.Struct<{ readonly _tag: Schema.tag<'L…;
check: (checks_0: SchemaAST.Check<{ readonly _tag: 'Literal'; readonly literal: string | number | bigint | boolean; readonly annotations?: { readonly [x: string]: unknown } | undefined }>, ...checks: Array<SchemaAST.Check<{ readonly _tag: 'Litera…;
rebuild: (ast: SchemaAST.Objects) => Schema.Struct<{ readonly _tag: Schema.tag<'Literal'>; readonly annotations: Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree…;
make: (input: { readonly literal: string | number | bigint | boolean; readonly _tag?: 'Literal' | undefined; readonly annotations?: { readonly [x: string]: unknown } | undefined }, options?: MakeOptions) => { readonly _tag: 'Literal'; readonly l…;
makeOption: (input: { readonly literal: string | number | bigint | boolean; readonly _tag?: 'Literal' | undefined; readonly annotations?: { readonly [x: string]: unknown } | undefined }, options?: MakeOptions) => Option_.Option<{ readonly _tag: 'Liter…;
makeEffect: (input: { readonly literal: string | number | bigint | boolean; readonly _tag?: 'Literal' | undefined; readonly annotations?: { readonly [x: string]: unknown } | undefined }, options?: MakeOptions) => Effect.Effect<{ readonly _tag: 'Litera…;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
Schema for the
Literal
representation node.
$Literal = import SchemaSchema.Struct({
_tag: Schema.tag<"Literal">(property) _tag: {
Type: S["Type"];
Encoded: S["Encoded"];
DecodingServices: S["DecodingServices"];
EncodingServices: S["EncodingServices"];
Iso: S["Iso"];
schema: S;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<'Literal', readonly []>) => Schema.withConstructorDefault<Schema.Literal<'Literal'>>;
annotateKey: (annotations: Schema.Annotations.Key<'Literal'>) => Schema.withConstructorDefault<Schema.Literal<'Literal'>>;
check: (checks_0: SchemaAST.Check<'Literal'>, ...checks: Array<SchemaAST.Check<'Literal'>>) => Schema.withConstructorDefault<Schema.Literal<'Literal'>>;
rebuild: (ast: SchemaAST.Literal) => Schema.withConstructorDefault<Schema.Literal<'Literal'>>;
make: (input: 'Literal', options?: MakeOptions) => 'Literal';
makeOption: (input: 'Literal', options?: MakeOptions) => Option_.Option<'Literal'>;
makeEffect: (input: 'Literal', options?: MakeOptions) => Effect.Effect<'Literal', SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
_tag: import SchemaSchema.tag("Literal"),
annotations: Schema.optional<
Schema.decodeTo<
Schema.$Record<Schema.String, Schema.Unknown>,
Schema.$Record<
Schema.String,
Schema.Codec<
PrimitiveTree,
PrimitiveTree,
never,
never
>
>,
never,
never
>
>
(property) annotations: {
Rebuild: optional<S>;
Type: S["Type"];
Encoded: S["Encoded"];
DecodingServices: S["DecodingServices"];
EncodingServices: S["EncodingServices"];
Iso: S["Iso"];
schema: S;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<{ readonly [x: string]: unknown; } | undefined, readonly []>) => Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTre…;
annotateKey: (annotations: Schema.Annotations.Key<{ readonly [x: string]: unknown } | undefined>) => Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree,…;
check: (checks_0: SchemaAST.Check<{ readonly [x: string]: unknown } | undefined>, ...checks: Array<SchemaAST.Check<{ readonly [x: string]: unknown } | undefined>>) => Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, …;
rebuild: (ast: SchemaAST.Union<SchemaAST.Undefined | SchemaAST.Objects>) => Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, neve…;
make: (input: { readonly [x: string]: unknown } | undefined, options?: MakeOptions) => { readonly [x: string]: unknown } | undefined;
makeOption: (input: { readonly [x: string]: unknown } | undefined, options?: MakeOptions) => Option_.Option<{ readonly [x: string]: unknown } | undefined>;
makeEffect: (input: { readonly [x: string]: unknown } | undefined, options?: MakeOptions) => Effect.Effect<{ readonly [x: string]: unknown } | undefined, SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
annotations: import SchemaSchema.optional(const $Annotations: Schema.decodeTo<
Schema.$Record<Schema.String, Schema.Unknown>,
Schema.$Record<
Schema.String,
Schema.Codec<
PrimitiveTree,
PrimitiveTree,
never,
never
>
>,
never,
never
>
const $Annotations: {
Type: To["Type"];
Encoded: From["Encoded"];
DecodingServices: To["DecodingServices"] | From["DecodingServices"] | RD;
EncodingServices: To["EncodingServices"] | From["EncodingServices"] | RE;
Iso: To["Iso"];
from: From;
to: To;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<{ readonly [x: string]: unknown; }, readonly []>) => Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, nev…;
annotateKey: (annotations: Schema.Annotations.Key<{ readonly [x: string]: unknown }>) => Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, neve…;
check: (checks_0: SchemaAST.Check<{ readonly [x: string]: unknown }>, ...checks: Array<SchemaAST.Check<{ readonly [x: string]: unknown }>>) => Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Cod…;
rebuild: (ast: SchemaAST.Objects) => Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, never>;
make: (input: { readonly [x: string]: unknown }, options?: MakeOptions) => { readonly [x: string]: unknown };
makeOption: (input: { readonly [x: string]: unknown }, options?: MakeOptions) => Option_.Option<{ readonly [x: string]: unknown }>;
makeEffect: (input: { readonly [x: string]: unknown }, options?: MakeOptions) => Effect.Effect<{ readonly [x: string]: unknown }, SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
Schema for serializing public Schema.Annotations.Annotations values. It
filters out internal annotation keys and non-primitive values during
encoding.
When to use
Use to serialize schema annotations in representation schemas while retaining
only primitive-tree metadata.
Details
Decoding is passthrough. Encoding removes internal annotation keys and values
that are not accepted by $PrimitiveTree.
$Annotations),
literal: Schema.Union<
readonly [
Schema.String,
Schema.Finite,
Schema.Boolean,
Schema.BigInt
]
>
(property) literal: {
Type: { [K in keyof Members]: Members[K]["Type"]; }[number];
Encoded: { [K in keyof Members]: Members[K]["Encoded"]; }[number];
DecodingServices: { [K in keyof Members]: Members[K]["DecodingServices"]; }[number];
EncodingServices: { [K in keyof Members]: Members[K]["EncodingServices"]; }[number];
Iso: { [K in keyof Members]: Members[K]["Iso"]; }[number];
members: Members;
mapMembers: (f: (members: readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.BigInt]) => To, options?: { readonly unsafePreserveChecks?: boolean | undefined } | undefined) => Schema.Union<{ [K in keyof Readonly<To>]: Readonly<To>[K]; }>;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<string | number | bigint | boolean, readonly []>) => Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.BigInt]>;
annotateKey: (annotations: Schema.Annotations.Key<string | number | bigint | boolean>) => Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.BigInt]>;
check: (checks_0: SchemaAST.Check<string | number | bigint | boolean>, ...checks: Array<SchemaAST.Check<string | number | bigint | boolean>>) => Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.BigInt]>;
rebuild: (ast: SchemaAST.Union<SchemaAST.String | SchemaAST.Number | SchemaAST.Boolean | SchemaAST.BigInt>) => Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.BigInt]>;
make: (input: string | number | bigint | boolean, options?: MakeOptions) => string | number | bigint | boolean;
makeOption: (input: string | number | bigint | boolean, options?: MakeOptions) => Option_.Option<string | number | bigint | boolean>;
makeEffect: (input: string | number | bigint | boolean, options?: MakeOptions) => Effect.Effect<string | number | bigint | boolean, SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
literal: const $LiteralValue: Schema.Union<
readonly [
Schema.String,
Schema.Finite,
Schema.Boolean,
Schema.BigInt
]
>
const $LiteralValue: {
Type: { [K in keyof Members]: Members[K]["Type"]; }[number];
Encoded: { [K in keyof Members]: Members[K]["Encoded"]; }[number];
DecodingServices: { [K in keyof Members]: Members[K]["DecodingServices"]; }[number];
EncodingServices: { [K in keyof Members]: Members[K]["EncodingServices"]; }[number];
Iso: { [K in keyof Members]: Members[K]["Iso"]; }[number];
members: Members;
mapMembers: (f: (members: readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.BigInt]) => To, options?: { readonly unsafePreserveChecks?: boolean | undefined } | undefined) => Schema.Union<{ [K in keyof Readonly<To>]: Readonly<To>[K]; }>;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<string | number | bigint | boolean, readonly []>) => Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.BigInt]>;
annotateKey: (annotations: Schema.Annotations.Key<string | number | bigint | boolean>) => Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.BigInt]>;
check: (checks_0: SchemaAST.Check<string | number | bigint | boolean>, ...checks: Array<SchemaAST.Check<string | number | bigint | boolean>>) => Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.BigInt]>;
rebuild: (ast: SchemaAST.Union<SchemaAST.String | SchemaAST.Number | SchemaAST.Boolean | SchemaAST.BigInt>) => Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.BigInt]>;
make: (input: string | number | bigint | boolean, options?: MakeOptions) => string | number | bigint | boolean;
makeOption: (input: string | number | bigint | boolean, options?: MakeOptions) => Option_.Option<string | number | bigint | boolean>;
makeEffect: (input: string | number | bigint | boolean, options?: MakeOptions) => Effect.Effect<string | number | bigint | boolean, SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
Schema for the literal value types allowed in a
Literal
node
(string, finite number, boolean, or bigint).
$LiteralValue
}).annotate({ identifier: stringidentifier: "Literal" })Referenced by 1 symbols