TimeZoneNamedType-level representation of TimeZoneNamed.
export interface TimeZoneNamed 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 DateTimeDateTime.declareTimeZone.type DateTime.TimeZone.Named = /*unresolved*/ anyNamed> {
readonly "Rebuild": TimeZoneNamed
}
const const TimeZoneNamedString: Stringconst TimeZoneNamedString: {
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; <…;
}
TimeZoneNamedString = 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.Bottom<string, string, never, never, String, String, string, string, readonly [], string, "readonly", "required", "no-default", "readonly", "required">.annotate(annotations: Annotations.Bottom<string, readonly []>): Stringannotate({ 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: "an IANA time zone identifier" })
/**
* Schema for `DateTime.TimeZone.Named` values.
*
* **Details**
*
* Default JSON serializer:
*
* - encodes `DateTime.TimeZone.Named` as a string (IANA time zone identifier)
*
* @category DateTime
* @since 3.10.0
*/
export const const TimeZoneNamed: TimeZoneNamedconst TimeZoneNamed: {
Rebuild: TimeZoneNamed;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Annotations.Bottom<DateTime.TimeZone.Named, readonly []>) => TimeZoneNamed;
annotateKey: (annotations: Annotations.Key<DateTime.TimeZone.Named>) => TimeZoneNamed;
check: (checks_0: SchemaAST.Check<DateTime.TimeZone.Named>, ...checks: Array<SchemaAST.Check<DateTime.TimeZone.Named>>) => TimeZoneNamed;
rebuild: (ast: SchemaAST.Declaration) => TimeZoneNamed;
make: (input: DateTime.TimeZone.Named, options?: MakeOptions) => DateTime.TimeZone.Named;
makeOption: (input: DateTime.TimeZone.Named, options?: MakeOptions) => Option_.Option<DateTime.TimeZone.Named>;
makeEffect: (input: DateTime.TimeZone.Named, options?: MakeOptions) => Effect.Effect<DateTime.TimeZone.Named, 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
TimeZoneNamed
.
Schema for DateTime.TimeZone.Named values.
Details
Default JSON serializer:
- encodes
DateTime.TimeZone.Named as a string (IANA time zone identifier)
TimeZoneNamed: TimeZoneNamed = 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 DateTimeDateTime.isTimeZoneNamed,
{
Annotations.Declaration<DateTime.TimeZone.Named, readonly []>.typeConstructor?: {
readonly [key: string]: unknown;
readonly _tag: string;
} | undefined
typeConstructor: {
_tag: string_tag: "effect/DateTime.TimeZone.Named"
},
Annotations.Declaration<DateTime.TimeZone.Named, readonly []>.generation?: {
readonly runtime: string;
readonly Type: string;
readonly Encoded?: string | undefined;
readonly importDeclaration?: string | undefined;
} | undefined
generation: {
runtime: stringruntime: `Schema.TimeZoneNamed`,
type Type: stringType: `DateTime.TimeZone.Named`,
importDeclaration?: string | undefinedimportDeclaration: `import * as DateTime from "effect/DateTime"`
},
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: "DateTime.TimeZone.Named",
Annotations.Declaration<DateTime.TimeZone.Named, 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 DateTimeDateTime.declareTimeZone.type DateTime.TimeZone.Named = /*unresolved*/ anyNamed>()(
const TimeZoneNamedString: Stringconst TimeZoneNamedString: {
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; <…;
}
TimeZoneNamedString,
import SchemaTransformationSchemaTransformation.const timeZoneNamedFromString: Transformation<
DateTime.TimeZone.Named,
string
>
const timeZoneNamedFromString: {
_tag: 'Transformation';
decode: SchemaGetter.Getter<T, E, RD>;
encode: SchemaGetter.Getter<E, T, RE>;
flip: () => SchemaTransformation.Transformation<string, DateTime.TimeZone.Named, never, never>;
compose: (other: SchemaTransformation.Transformation<T2, DateTime.TimeZone.Named, RD2, RE2>) => SchemaTransformation.Transformation<T2, string, RD2, RE2>;
}
Decodes an IANA time-zone identifier string into a
DateTime.TimeZone.Named and encodes a named time zone back to its id.
When to use
Use when you need a schema transformation to accept only IANA time-zone
identifier strings and produce DateTime.TimeZone.Named values.
Details
Decode fails with InvalidValue when the string is not a valid IANA time-zone
identifier.
timeZoneNamedFromString
),
Annotations.Declaration<DateTime.TimeZone.Named, readonly []>.toArbitrary?: Annotations.ToArbitrary.Declaration<DateTime.TimeZone.Named, readonly []> | undefinedtoArbitrary: () => (fc: typeof FastCheckfc) =>
fc: typeof FastCheckfc.constantFrom(
...["UTC", "Europe/London", "America/New_York", "Asia/Tokyo", "Australia/Sydney"].Array<string>.map<unknown>(callbackfn: (value: string, index: number, array: string[]) => unknown, thisArg?: any): unknown[]Calls a defined callback function on each element of an array, and returns an array that contains the results.
map(
import DateTimeDateTime.zoneMakeNamedUnsafe
)
),
Annotations.Declaration<DateTime.TimeZone.Named, readonly []>.toFormatter?: Annotations.ToFormatter.Declaration<DateTime.TimeZone.Named, readonly []> | undefinedtoFormatter: () => (tz: any(parameter) tz: {
_tag: "Named";
id: string;
format: Intl.DateTimeFormat;
toString: () => string;
toJSON: () => unknown;
}
tz) => import DateTimeDateTime.zoneToString(tz: any(parameter) tz: {
_tag: "Named";
id: string;
format: Intl.DateTimeFormat;
toString: () => string;
toJSON: () => unknown;
}
tz),
Annotations.Declaration<DateTime.TimeZone.Named, readonly []>.toEquivalence?: Annotations.ToEquivalence.Declaration<DateTime.TimeZone.Named, readonly []> | undefinedtoEquivalence: () => (a: any(parameter) a: {
_tag: "Named";
id: string;
format: Intl.DateTimeFormat;
toString: () => string;
toJSON: () => unknown;
}
a, b: any(parameter) b: {
_tag: "Named";
id: string;
format: Intl.DateTimeFormat;
toString: () => string;
toJSON: () => unknown;
}
b) => a: any(parameter) a: {
_tag: "Named";
id: string;
format: Intl.DateTimeFormat;
toString: () => string;
toJSON: () => unknown;
}
a.id === b: any(parameter) b: {
_tag: "Named";
id: string;
format: Intl.DateTimeFormat;
toString: () => string;
toJSON: () => unknown;
}
b.id
}
)