OptionIterator<T>Iterator protocol used to yield an Option inside gen, returning the
contained value type back to the generator.
When to use
Use when defining or typing [Symbol.iterator]() for Option values so
yield* can pass the contained value type back into Option.gen.
export interface interface OptionIterator<T extends Option<any>>Iterator protocol used to yield an Option inside
gen
, returning the
contained value type back to the generator.
When to use
Use when defining or typing [Symbol.iterator]() for Option values so
yield* can pass the contained value type back into Option.gen.
OptionIterator<function (type parameter) T in OptionIterator<T extends Option<any>>T extends type Option<A> = None<A> | Some<A>The Option data type represents optional values. An Option<A> is either
Some<A>, containing a value of type A, or None, representing absence.
When to use
Use to represent initial values that may not yet exist
- Returning from partial functions (not defined for all inputs)
- Managing optional fields in data structures
Namespace containing utility types for Option.
When to use
Use to access type-level helpers associated with Option.
Option<any>> {
OptionIterator<T extends Option<any>>.next(...args: ReadonlyArray<any>): IteratorResult<T, Option.Value<T>>next(
...args: readonly any[]args: interface ReadonlyArray<T>ReadonlyArray<any>
): type IteratorResult<T, TReturn = any> =
| IteratorYieldResult<T>
| IteratorReturnResult<TReturn>
IteratorResult<function (type parameter) T in OptionIterator<T extends Option<any>>T, Option.type Option<A>.Value<T extends Option<any>> = [T] extends [Option<infer _A>] ? _A : neverExtracts the type of the value contained in an Option.
When to use
Use to infer the inner value type from an existing Option type.
Example (Extracting the value type)
import type { Option } from "effect"
declare const myOption: Option.Option<string>
// ┌─── string
// ▼
type MyType = Option.Option.Value<typeof myOption>
Value<function (type parameter) T in OptionIterator<T extends Option<any>>T>>
}