DurationType-level representation of Duration.
export interface Duration extends interface declare<T, Iso = T>Creates a schema for a non-parametric opaque type using a type-guard
function. The schema accepts any unknown value and succeeds when is returns
true, failing with an InvalidType issue otherwise.
When to use
Use when you are defining a schema for an opaque type with no type parameters
and validation can be expressed as a type guard.
Example (Defining a schema for a custom UserId branded type)
import { Schema } from "effect"
type UserId = string & { readonly _tag: "UserId" }
const isUserId = (u: unknown): u is UserId =>
typeof u === "string" && u.startsWith("user_")
const UserId = Schema.declare<UserId>(isUserId, {
title: "UserId",
description: "A user identifier starting with 'user_'"
})
Type-level representation returned by
declare
.
declare<import Duration_Duration_.type Duration_.Duration = /*unresolved*/ anyDuration> {
readonly "Rebuild": Duration
}
/**
* Schema for `Duration` values.
*
* **Details**
*
* The default JSON serializer encodes `Duration` as a tagged object with the
* duration type and value.
*
* **Example** (Defining a Duration schema)
*
* ```ts
* import { Duration, Schema } from "effect"
*
* Schema.decodeUnknownSync(Schema.Duration)(Duration.seconds(5))
* // => Duration(5s)
* ```
*
* @category Duration
*
* @since 3.10.0
*/
export const const Duration: Durationconst Duration: {
Rebuild: Duration;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Annotations.Bottom<Duration_.Duration, readonly []>) => Duration;
annotateKey: (annotations: Annotations.Key<Duration_.Duration>) => Duration;
check: (checks_0: SchemaAST.Check<Duration_.Duration>, ...checks: Array<SchemaAST.Check<Duration_.Duration>>) => Duration;
rebuild: (ast: SchemaAST.Declaration) => Duration;
make: (input: Duration_.Duration, options?: MakeOptions) => Duration_.Duration;
makeOption: (input: Duration_.Duration, options?: MakeOptions) => Option_.Option<Duration_.Duration>;
makeEffect: (input: Duration_.Duration, options?: MakeOptions) => Effect.Effect<Duration_.Duration, 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
Duration
.
Schema for Duration values.
Details
The default JSON serializer encodes Duration as a tagged object with the
duration type and value.
Example (Defining a Duration schema)
import { Duration, Schema } from "effect"
Schema.decodeUnknownSync(Schema.Duration)(Duration.seconds(5))
// => Duration(5s)
Duration: Duration = function declare<T, Iso = T>(
is: (u: unknown) => u is T,
annotations?:
| Annotations.Declaration<T>
| undefined
): declare<T, Iso>
Creates a schema for a non-parametric opaque type using a type-guard
function. The schema accepts any unknown value and succeeds when is returns
true, failing with an InvalidType issue otherwise.
When to use
Use when you are defining a schema for an opaque type with no type parameters
and validation can be expressed as a type guard.
Example (Defining a schema for a custom UserId branded type)
import { Schema } from "effect"
type UserId = string & { readonly _tag: "UserId" }
const isUserId = (u: unknown): u is UserId =>
typeof u === "string" && u.startsWith("user_")
const UserId = Schema.declare<UserId>(isUserId, {
title: "UserId",
description: "A user identifier starting with 'user_'"
})
declare(
import Duration_Duration_.isDuration,
{
Annotations.Declaration<Duration_.Duration, readonly []>.typeConstructor?: {
readonly [key: string]: unknown;
readonly _tag: string;
} | undefined
typeConstructor: {
_tag: string_tag: "effect/Duration"
},
Annotations.Declaration<Duration_.Duration, readonly []>.generation?: {
readonly runtime: string;
readonly Type: string;
readonly Encoded?: string | undefined;
readonly importDeclaration?: string | undefined;
} | undefined
generation: {
runtime: stringruntime: `Schema.Duration`,
type Type: stringType: `Duration.Duration`,
importDeclaration?: string | undefinedimportDeclaration: `import * as Duration from "effect/Duration"`
},
Annotations.Augment.expected?: string | undefinedHuman-readable description of what a value is expected to satisfy.
Details
For filter and refinement failures, the default formatter uses
message first, then expected, and finally falls back to <filter>.
Use this to name a failed filter in the default message:
Expected <expected>, got <actual>.
expected: "Duration",
Annotations.Declaration<Duration_.Duration, readonly []>.toCodecJson?: ((typeParameters: readonly []) => SchemaAST.Link) | undefinedtoCodecJson: () =>
function link<T>(): <
To extends Constraint
>(
encodeTo: To,
transformation: {
readonly decode: SchemaGetter.Getter<
T,
NoInfer<To["Type"]>
>
readonly encode: SchemaGetter.Getter<
NoInfer<To["Type"]>,
T
>
}
) => SchemaAST.Link
Constructs an SchemaAST.Link that describes how a value of type T encodes to and decodes from a To schema.
Used when building low-level AST transformations that bridge two schema types.
link<import Duration_Duration_.type Duration_.Duration = /*unresolved*/ anyDuration>()(
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([
function Struct<
Fields extends Struct.Fields
>(fields: Fields): Struct<Fields>
Defines a struct schema from a map of field schemas.
Details
Each field value is a schema. Use
optionalKey
or
optional
to
mark fields as optional, and
mutableKey
to mark them as mutable.
The resulting schema's Type is a readonly object type with the fields'
decoded types. The Encoded form mirrors the field schemas' encoded types.
Example (Defining a basic struct)
import { Schema } from "effect"
const Person = Schema.Struct({
name: Schema.String,
age: Schema.Number,
email: Schema.optionalKey(Schema.String)
})
// { readonly name: string; readonly age: number; readonly email?: string }
type Person = typeof Person.Type
const alice = Schema.decodeUnknownSync(Person)({ name: "Alice", age: 30 })
console.log(alice)
// { name: 'Alice', age: 30 }
Struct({ _tag: Literal<"Infinity">(property) _tag: {
literal: L;
transform: (to: L2) => decodeTo<Literal<L2>, Literal<'Infinity'>, never, never>;
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Annotations.Bottom<'Infinity', readonly []>) => Literal<'Infinity'>;
annotateKey: (annotations: Annotations.Key<'Infinity'>) => Literal<'Infinity'>;
check: (checks_0: SchemaAST.Check<'Infinity'>, ...checks: Array<SchemaAST.Check<'Infinity'>>) => Literal<'Infinity'>;
rebuild: (ast: SchemaAST.Literal) => Literal<'Infinity'>;
make: (input: 'Infinity', options?: MakeOptions) => 'Infinity';
makeOption: (input: 'Infinity', options?: MakeOptions) => Option_.Option<'Infinity'>;
makeEffect: (input: 'Infinity', options?: MakeOptions) => Effect.Effect<'Infinity', 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: function Literal<
L extends SchemaAST.LiteralValue
>(literal: L): Literal<L>
Creates a schema for a single literal value (string, number, bigint, boolean, or null).
Example (Defining a string literal)
import { Schema } from "effect"
const schema = Schema.Literal("hello")
// Type: Schema.Literal<"hello">
Literal("Infinity") }),
function Struct<
Fields extends Struct.Fields
>(fields: Fields): Struct<Fields>
Defines a struct schema from a map of field schemas.
Details
Each field value is a schema. Use
optionalKey
or
optional
to
mark fields as optional, and
mutableKey
to mark them as mutable.
The resulting schema's Type is a readonly object type with the fields'
decoded types. The Encoded form mirrors the field schemas' encoded types.
Example (Defining a basic struct)
import { Schema } from "effect"
const Person = Schema.Struct({
name: Schema.String,
age: Schema.Number,
email: Schema.optionalKey(Schema.String)
})
// { readonly name: string; readonly age: number; readonly email?: string }
type Person = typeof Person.Type
const alice = Schema.decodeUnknownSync(Person)({ name: "Alice", age: 30 })
console.log(alice)
// { name: 'Alice', age: 30 }
Struct({ _tag: Literal<"NegativeInfinity">(property) _tag: {
literal: L;
transform: (to: L2) => decodeTo<Literal<L2>, Literal<'NegativeInfinity'>, never, never>;
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Annotations.Bottom<'NegativeInfinity', readonly []>) => Literal<'NegativeInfinity'>;
annotateKey: (annotations: Annotations.Key<'NegativeInfinity'>) => Literal<'NegativeInfinity'>;
check: (checks_0: SchemaAST.Check<'NegativeInfinity'>, ...checks: Array<SchemaAST.Check<'NegativeInfinity'>>) => Literal<'NegativeInfinity'>;
rebuild: (ast: SchemaAST.Literal) => Literal<'NegativeInfinity'>;
make: (input: 'NegativeInfinity', options?: MakeOptions) => 'NegativeInfinity';
makeOption: (input: 'NegativeInfinity', options?: MakeOptions) => Option_.Option<'NegativeInfinity'>;
makeEffect: (input: 'NegativeInfinity', options?: MakeOptions) => Effect.Effect<'NegativeInfinity', 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: function Literal<
L extends SchemaAST.LiteralValue
>(literal: L): Literal<L>
Creates a schema for a single literal value (string, number, bigint, boolean, or null).
Example (Defining a string literal)
import { Schema } from "effect"
const schema = Schema.Literal("hello")
// Type: Schema.Literal<"hello">
Literal("NegativeInfinity") }),
function Struct<
Fields extends Struct.Fields
>(fields: Fields): Struct<Fields>
Defines a struct schema from a map of field schemas.
Details
Each field value is a schema. Use
optionalKey
or
optional
to
mark fields as optional, and
mutableKey
to mark them as mutable.
The resulting schema's Type is a readonly object type with the fields'
decoded types. The Encoded form mirrors the field schemas' encoded types.
Example (Defining a basic struct)
import { Schema } from "effect"
const Person = Schema.Struct({
name: Schema.String,
age: Schema.Number,
email: Schema.optionalKey(Schema.String)
})
// { readonly name: string; readonly age: number; readonly email?: string }
type Person = typeof Person.Type
const alice = Schema.decodeUnknownSync(Person)({ name: "Alice", age: 30 })
console.log(alice)
// { name: 'Alice', age: 30 }
Struct({ _tag: Literal<"Nanos">(property) _tag: {
literal: L;
transform: (to: L2) => decodeTo<Literal<L2>, Literal<'Nanos'>, never, never>;
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Annotations.Bottom<'Nanos', readonly []>) => Literal<'Nanos'>;
annotateKey: (annotations: Annotations.Key<'Nanos'>) => Literal<'Nanos'>;
check: (checks_0: SchemaAST.Check<'Nanos'>, ...checks: Array<SchemaAST.Check<'Nanos'>>) => Literal<'Nanos'>;
rebuild: (ast: SchemaAST.Literal) => Literal<'Nanos'>;
make: (input: 'Nanos', options?: MakeOptions) => 'Nanos';
makeOption: (input: 'Nanos', options?: MakeOptions) => Option_.Option<'Nanos'>;
makeEffect: (input: 'Nanos', options?: MakeOptions) => Effect.Effect<'Nanos', 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: function Literal<
L extends SchemaAST.LiteralValue
>(literal: L): Literal<L>
Creates a schema for a single literal value (string, number, bigint, boolean, or null).
Example (Defining a string literal)
import { Schema } from "effect"
const schema = Schema.Literal("hello")
// Type: Schema.Literal<"hello">
Literal("Nanos"), value: BigInt(property) value: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Annotations.Bottom<bigint, readonly []>) => BigInt;
annotateKey: (annotations: Annotations.Key<bigint>) => BigInt;
check: (checks_0: SchemaAST.Check<bigint>, ...checks: Array<SchemaAST.Check<bigint>>) => BigInt;
rebuild: (ast: SchemaAST.BigInt) => BigInt;
make: (input: bigint, options?: MakeOptions) => bigint;
makeOption: (input: bigint, options?: MakeOptions) => Option_.Option<bigint>;
makeEffect: (input: bigint, options?: MakeOptions) => Effect.Effect<bigint, 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; <…;
}
value: const BigInt: BigIntconst BigInt: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Annotations.Bottom<bigint, readonly []>) => BigInt;
annotateKey: (annotations: Annotations.Key<bigint>) => BigInt;
check: (checks_0: SchemaAST.Check<bigint>, ...checks: Array<SchemaAST.Check<bigint>>) => BigInt;
rebuild: (ast: SchemaAST.BigInt) => BigInt;
make: (input: bigint, options?: MakeOptions) => bigint;
makeOption: (input: bigint, options?: MakeOptions) => Option_.Option<bigint>;
makeEffect: (input: bigint, options?: MakeOptions) => Effect.Effect<bigint, 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
BigInt
.
Schema for bigint values. Validates that the input is typeof "bigint".
When to use
Use when the input is already a bigint and the schema should validate and
preserve bigint values without parsing from another representation.
BigInt }),
function Struct<
Fields extends Struct.Fields
>(fields: Fields): Struct<Fields>
Defines a struct schema from a map of field schemas.
Details
Each field value is a schema. Use
optionalKey
or
optional
to
mark fields as optional, and
mutableKey
to mark them as mutable.
The resulting schema's Type is a readonly object type with the fields'
decoded types. The Encoded form mirrors the field schemas' encoded types.
Example (Defining a basic struct)
import { Schema } from "effect"
const Person = Schema.Struct({
name: Schema.String,
age: Schema.Number,
email: Schema.optionalKey(Schema.String)
})
// { readonly name: string; readonly age: number; readonly email?: string }
type Person = typeof Person.Type
const alice = Schema.decodeUnknownSync(Person)({ name: "Alice", age: 30 })
console.log(alice)
// { name: 'Alice', age: 30 }
Struct({ _tag: Literal<"Millis">(property) _tag: {
literal: L;
transform: (to: L2) => decodeTo<Literal<L2>, Literal<'Millis'>, never, never>;
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Annotations.Bottom<'Millis', readonly []>) => Literal<'Millis'>;
annotateKey: (annotations: Annotations.Key<'Millis'>) => Literal<'Millis'>;
check: (checks_0: SchemaAST.Check<'Millis'>, ...checks: Array<SchemaAST.Check<'Millis'>>) => Literal<'Millis'>;
rebuild: (ast: SchemaAST.Literal) => Literal<'Millis'>;
make: (input: 'Millis', options?: MakeOptions) => 'Millis';
makeOption: (input: 'Millis', options?: MakeOptions) => Option_.Option<'Millis'>;
makeEffect: (input: 'Millis', options?: MakeOptions) => Effect.Effect<'Millis', 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: function Literal<
L extends SchemaAST.LiteralValue
>(literal: L): Literal<L>
Creates a schema for a single literal value (string, number, bigint, boolean, or null).
Example (Defining a string literal)
import { Schema } from "effect"
const schema = Schema.Literal("hello")
// Type: Schema.Literal<"hello">
Literal("Millis"), value: Int(property) value: {
Rebuild: Int;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Annotations.Bottom<number, readonly []>) => Int;
annotateKey: (annotations: Annotations.Key<number>) => Int;
check: (checks_0: SchemaAST.Check<number>, ...checks: Array<SchemaAST.Check<number>>) => Int;
rebuild: (ast: SchemaAST.Number) => Int;
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; <…;
}
value: const Int: Intconst Int: {
Rebuild: Int;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Annotations.Bottom<number, readonly []>) => Int;
annotateKey: (annotations: Annotations.Key<number>) => Int;
check: (checks_0: SchemaAST.Check<number>, ...checks: Array<SchemaAST.Check<number>>) => Int;
rebuild: (ast: SchemaAST.Number) => Int;
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
Int
.
Schema for integers, rejecting NaN, Infinity, and -Infinity.
Int })
]),
import SchemaTransformationSchemaTransformation.function transform<T, E>(options: {
readonly decode: (input: E) => T
readonly encode: (input: T) => E
}): Transformation<T, E>
Creates a Transformation from pure (sync, infallible) decode and encode
functions.
When to use
Use when you need an infallible schema transformation that does not require
Effect services.
Details
- Each function receives the input and returns the output directly.
- Skips
None inputs (missing keys) — functions are only called on present values.
- Does not allocate Effects internally; uses optimized sync path.
Example (Converting between cents and dollars)
import { Schema, SchemaTransformation } from "effect"
const CentsFromDollars = Schema.Number.pipe(
Schema.decodeTo(
Schema.Number,
SchemaTransformation.transform({
decode: (dollars) => dollars * 100,
encode: (cents) => cents / 100
})
)
)
transform({
decode: (
input: NoInfer<
| Struct.ReadonlySide<
{
readonly _tag: Literal<"Infinity">
},
"Type"
>
| Struct.ReadonlySide<
{
readonly _tag: Literal<"NegativeInfinity">
},
"Type"
>
| Struct.ReadonlySide<
{
readonly _tag: Literal<"Nanos">
readonly value: BigInt
},
"Type"
>
| Struct.ReadonlySide<
{
readonly _tag: Literal<"Millis">
readonly value: Int
},
"Type"
>
>
) => any
decode: (e: NoInfer<
| Struct.ReadonlySide<
{
readonly _tag: Literal<"Infinity">
},
"Type"
>
| Struct.ReadonlySide<
{
readonly _tag: Literal<"NegativeInfinity">
},
"Type"
>
| Struct.ReadonlySide<
{
readonly _tag: Literal<"Nanos">
readonly value: BigInt
},
"Type"
>
| Struct.ReadonlySide<
{
readonly _tag: Literal<"Millis">
readonly value: Int
},
"Type"
>
>
e) => {
switch (e: | Struct.ReadonlySide<
{
readonly _tag: Literal<"Infinity">
},
"Type"
>
| Struct.ReadonlySide<
{
readonly _tag: Literal<"NegativeInfinity">
},
"Type"
>
| Struct.ReadonlySide<
{
readonly _tag: Literal<"Nanos">
readonly value: BigInt
},
"Type"
>
| Struct.ReadonlySide<
{
readonly _tag: Literal<"Millis">
readonly value: Int
},
"Type"
>
e._tag: | "Infinity"
| "NegativeInfinity"
| "Nanos"
| "Millis"
_tag) {
case "Infinity":
return import Duration_Duration_.infinity
case "NegativeInfinity":
return import Duration_Duration_.negativeInfinity
case "Nanos":
return import Duration_Duration_.nanos(e: Struct.ReadonlySide<
{
readonly _tag: Literal<"Nanos">
readonly value: BigInt
},
"Type"
>
(parameter) e: {
_tag: 'Nanos';
value: bigint;
}
e.value: bigintvalue)
case "Millis":
return import Duration_Duration_.millis(e: Struct.ReadonlySide<
{
readonly _tag: Literal<"Millis">
readonly value: Int
},
"Type"
>
(parameter) e: {
_tag: 'Millis';
value: number;
}
e.value: numbervalue)
}
},
encode: (input: any) => NoInfer<
| Struct.ReadonlySide<
{
readonly _tag: Literal<"Infinity">
},
"Type"
>
| Struct.ReadonlySide<
{
readonly _tag: Literal<"NegativeInfinity">
},
"Type"
>
| Struct.ReadonlySide<
{
readonly _tag: Literal<"Nanos">
readonly value: BigInt
},
"Type"
>
| Struct.ReadonlySide<
{
readonly _tag: Literal<"Millis">
readonly value: Int
},
"Type"
>
>
encode: (duration: Duration_.Duration(parameter) duration: {
value: DurationValue;
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; <…;
toString: () => string;
toJSON: () => unknown;
}
duration) => {
switch (duration: Duration_.Duration(parameter) duration: {
value: DurationValue;
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; <…;
toString: () => string;
toJSON: () => unknown;
}
duration.value._tag) {
case "Infinity":
return { _tag: | "Infinity"
| "NegativeInfinity"
| "Nanos"
| "Millis"
_tag: "Infinity" } as type const = {
readonly _tag: "Infinity";
}
const
case "NegativeInfinity":
return { _tag: | "Infinity"
| "NegativeInfinity"
| "Nanos"
| "Millis"
_tag: "NegativeInfinity" } as type const = {
readonly _tag: "NegativeInfinity";
}
const
case "Nanos":
return { _tag: | "Infinity"
| "NegativeInfinity"
| "Nanos"
| "Millis"
_tag: "Nanos", value: anyvalue: duration: Duration_.Duration(parameter) duration: {
value: DurationValue;
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; <…;
toString: () => string;
toJSON: () => unknown;
}
duration.value.nanos } as type const = {
readonly _tag: "Nanos";
readonly value: any;
}
const
case "Millis":
return { _tag: | "Infinity"
| "NegativeInfinity"
| "Nanos"
| "Millis"
_tag: "Millis", value: anyvalue: duration: Duration_.Duration(parameter) duration: {
value: DurationValue;
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; <…;
toString: () => string;
toJSON: () => unknown;
}
duration.value.millis } as type const = {
readonly _tag: "Millis";
readonly value: any;
}
const
}
}
})
),
Annotations.Declaration<Duration_.Duration, readonly []>.toArbitrary?: Annotations.ToArbitrary.Declaration<Duration_.Duration, readonly []> | undefinedtoArbitrary: () => (fc: typeof FastCheckfc) =>
fc: typeof FastCheckfc.oneof(
fc: typeof FastCheckfc.constant(import Duration_Duration_.infinity),
fc: typeof FastCheckfc.constant(import Duration_Duration_.negativeInfinity),
fc: typeof FastCheckfc.bigInt().map(import Duration_Duration_.nanos),
fc: typeof FastCheckfc.maxSafeInteger().map(import Duration_Duration_.millis)
),
Annotations.Declaration<Duration_.Duration, readonly []>.toFormatter?: Annotations.ToFormatter.Declaration<Duration_.Duration, readonly []> | undefinedtoFormatter: () => module globalThisglobalThis.var String: StringConstructorAllows manipulation and formatting of text strings and determination and location of substrings within strings.
String,
Annotations.Declaration<Duration_.Duration, readonly []>.toEquivalence?: Annotations.ToEquivalence.Declaration<Duration_.Duration, readonly []> | undefinedtoEquivalence: () => import Duration_Duration_.Equivalence
}
)