MutableJsonRecursive TypeScript type for mutable JSON values: null, number,
boolean, string, mutable arrays, or mutable string-keyed records.
export type type MutableJson =
| string
| number
| boolean
| MutableJsonArray
| MutableJsonObject
| null
Recursive TypeScript type for mutable JSON values: null, number,
boolean, string, mutable arrays, or mutable string-keyed records.
Schema that accepts any mutable JSON-compatible value. See
Json
for
the immutable variant.
MutableJson = null | number | boolean | string | MutableJsonArray | MutableJsonObject
/**
* A mutable array of {@link MutableJson} values.
*
* @category models
* @since 4.0.0
*/
export interface MutableJsonArray extends interface Array<T>Array<type MutableJson =
| string
| number
| boolean
| MutableJsonArray
| MutableJsonObject
| null
Recursive TypeScript type for mutable JSON values: null, number,
boolean, string, mutable arrays, or mutable string-keyed records.
Schema that accepts any mutable JSON-compatible value. See
Json
for
the immutable variant.
MutableJson> {}
/**
* A mutable record whose values are {@link MutableJson} values.
*
* @category models
* @since 4.0.0
*/
export interface MutableJsonObject {
[x: stringx: string]: type MutableJson =
| string
| number
| boolean
| MutableJsonArray
| MutableJsonObject
| null
Recursive TypeScript type for mutable JSON values: null, number,
boolean, string, mutable arrays, or mutable string-keyed records.
Schema that accepts any mutable JSON-compatible value. See
Json
for
the immutable variant.
MutableJson
}
/**
* Schema that accepts any mutable JSON-compatible value. See {@link Json} for
* the immutable variant.
*
* @category schemas
* @since 4.0.0
*/
export const const MutableJson: Codec<MutableJson>const MutableJson: {
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
Rebuild: Codec<T, E, RD, RE>;
Type: T;
Iso: Iso;
ast: Ast;
annotate: (annotations: Annotations.Bottom<MutableJson, any>) => Codec<MutableJson, MutableJson, never, never>;
annotateKey: (annotations: Annotations.Key<MutableJson>) => Codec<MutableJson, MutableJson, never, never>;
check: (checks_0: SchemaAST.Check<MutableJson>, ...checks: Array<SchemaAST.Check<MutableJson>>) => Codec<MutableJson, MutableJson, never, never>;
rebuild: (ast: SchemaAST.AST) => Codec<MutableJson, MutableJson, never, never>;
make: (input: unknown, options?: MakeOptions) => MutableJson;
makeOption: (input: unknown, options?: MakeOptions) => Option_.Option<MutableJson>;
makeEffect: (input: unknown, options?: MakeOptions) => Effect.Effect<MutableJson, 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; <…;
}
Recursive TypeScript type for mutable JSON values: null, number,
boolean, string, mutable arrays, or mutable string-keyed records.
Schema that accepts any mutable JSON-compatible value. See
Json
for
the immutable variant.
MutableJson: interface Codec<out T, out E = T, out RD = never, out RE = never>Namespace of type-level helpers for
Codec
.
A schema that tracks the decoded type T, the encoded type E, and the
Effect services required during decoding (RD) and encoding (RE).
Details
Use Codec<T, E, RD, RE> when you need to preserve full type information
about a schema — both what it decodes to and what it serializes from/to.
Most concrete schemas produced by this module implement Codec.
For APIs that only need one direction, prefer the narrower views:
Decoder
<T, RD> — decode-only
Encoder
<E, RE> — encode-only
Schema
<T> — type-only (no encoded representation)
Example (Accepting a codec that decodes to number from string)
import { Schema } from "effect"
declare function serialize<T>(codec: Schema.Codec<T, string>): string
serialize(Schema.NumberFromString) // ok — decodes number, encoded as string
Codec<type MutableJson =
| string
| number
| boolean
| MutableJsonArray
| MutableJsonObject
| null
Recursive TypeScript type for mutable JSON values: null, number,
boolean, string, mutable arrays, or mutable string-keyed records.
Schema that accepts any mutable JSON-compatible value. See
Json
for
the immutable variant.
MutableJson> = const make: <S extends Constraint>(
ast: S["ast"],
options?: object
) => S
Creates a schema from an AST (Abstract Syntax Tree) node.
Details
This is the fundamental constructor for all schemas in the Effect Schema
library. It takes an AST node and wraps it in a fully-typed schema that
preserves all type information and provides the complete schema API.
The make function is used internally to create all primitive schemas like
String, Number, Boolean, etc., as well as more complex schemas. It's
the bridge between the untyped AST representation and the strongly-typed
schema.
make(import SchemaASTSchemaAST.const MutableJson: SchemaAST.Declarationconst MutableJson: {
_tag: 'Declaration';
typeParameters: ReadonlyArray<AST>;
run: (typeParameters: ReadonlyArray<AST>) => (input: unknown, self: Declaration, options: ParseOptions) => Effect.Effect<any, SchemaIssue.Issue, any>;
encodingChecks: Checks | undefined;
getParser: () => SchemaParser.Parser;
_rebuild: (recur: (ast: AST) => AST, checks: Checks | undefined, encodingChecks: Checks | undefined) => Declaration;
recur: (recur: (ast: AST) => AST) => Declaration;
flip: (recur: (ast: AST) => AST) => Declaration;
getExpected: () => string;
annotations: Schema.Annotations.Annotations | undefined;
checks: Checks | undefined;
encoding: Encoding | undefined;
context: Context | undefined;
toString: () => string;
}
MutableJson)