Union<readonly [Finite, Symbol, String]>Schema for property keys accepted by Effect schemas: finite number,
symbol, or string.
PropertyKey
Source effect/Schema.ts:117941 lines
export const const PropertyKey: Union<
readonly [Finite, Symbol, String]
>
const PropertyKey: {
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 [Finite, Symbol, String]) => To, options?: { readonly unsafePreserveChecks?: boolean | undefined } | undefined) => Union<{ [K in keyof Readonly<To>]: Readonly<To>[K]; }>;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Annotations.Bottom<string | number | symbol, readonly []>) => Union<readonly [Finite, Symbol, String]>;
annotateKey: (annotations: Annotations.Key<string | number | symbol>) => Union<readonly [Finite, Symbol, String]>;
check: (checks_0: SchemaAST.Check<string | number | symbol>, ...checks: Array<SchemaAST.Check<string | number | symbol>>) => Union<readonly [Finite, Symbol, String]>;
rebuild: (ast: SchemaAST.Union<SchemaAST.String | SchemaAST.Number | SchemaAST.Symbol>) => Union<readonly [Finite, Symbol, String]>;
make: (input: string | number | symbol, options?: MakeOptions) => string | number | symbol;
makeOption: (input: string | number | symbol, options?: MakeOptions) => Option_.Option<string | number | symbol>;
makeEffect: (input: string | number | symbol, options?: MakeOptions) => Effect.Effect<string | number | symbol, 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 property keys accepted by Effect schemas: finite number,
symbol, or string.
PropertyKey = function Union<
Members extends ReadonlyArray<Constraint>
>(
members: Members,
options?: { mode?: "anyOf" | "oneOf" }
): Union<Members>
Creates a union schema from an array of member schemas. Members are tested in
order; the first match is returned.
Details
Optionally, specify mode:
"anyOf" (default) — matches if any member matches.
"oneOf" — matches if exactly one member matches.
Example (Defining a string or number union)
import { Schema } from "effect"
const schema = Schema.Union([Schema.String, Schema.Number])
Schema.decodeUnknownSync(schema)("hello") // "hello"
Schema.decodeUnknownSync(schema)(42) // 42
Union([const Finite: Finiteconst Finite: {
Rebuild: Finite;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Annotations.Bottom<number, readonly []>) => Finite;
annotateKey: (annotations: Annotations.Key<number>) => Finite;
check: (checks_0: SchemaAST.Check<number>, ...checks: Array<SchemaAST.Check<number>>) => Finite;
rebuild: (ast: SchemaAST.Number) => Finite;
make: (input: number, options?: MakeOptions) => number;
makeOption: (input: number, options?: MakeOptions) => Option_.Option<number>;
makeEffect: (input: number, options?: MakeOptions) => Effect.Effect<number, 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; <…;
}
Type-level representation of
Finite
.
Schema for finite numbers, rejecting NaN, Infinity, and -Infinity.
Finite, const Symbol: Symbolconst Symbol: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Annotations.Bottom<symbol, readonly []>) => Symbol;
annotateKey: (annotations: Annotations.Key<symbol>) => Symbol;
check: (checks_0: SchemaAST.Check<symbol>, ...checks: Array<SchemaAST.Check<symbol>>) => Symbol;
rebuild: (ast: SchemaAST.Symbol) => Symbol;
make: (input: symbol, options?: MakeOptions) => symbol;
makeOption: (input: symbol, options?: MakeOptions) => Option_.Option<symbol>;
makeEffect: (input: symbol, options?: MakeOptions) => Effect.Effect<symbol, 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; <…;
}
Type-level representation of
Symbol
.
Schema for symbol values. Validates that the input is typeof "symbol".
Symbol, const String: Stringconst String: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Annotations.Bottom<string, readonly []>) => String;
annotateKey: (annotations: Annotations.Key<string>) => String;
check: (checks_0: SchemaAST.Check<string>, ...checks: Array<SchemaAST.Check<string>>) => String;
rebuild: (ast: SchemaAST.String) => String;
make: (input: string, options?: MakeOptions) => string;
makeOption: (input: string, options?: MakeOptions) => Option_.Option<string>;
makeEffect: (input: string, options?: MakeOptions) => Effect.Effect<string, 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; <…;
}
Type-level representation of
String
.
Schema for string values. Validates that the input is typeof "string".
String])Referenced by 2 symbols