<A = never>(): Option<A>Creates an Option representing the absence of a value.
When to use
Use to represent a missing or uninitialized value, such as returning "no result" from a function.
Details
- Returns
Option<never>, which is a subtype ofOption<A>for anyA - Always returns the same singleton instance
Example (Creating an empty Option)
import { Option } from "effect"
// ┌─── Option<never>
// ▼
const noValue = Option.none()
console.log(noValue)
// Output: { _id: 'Option', _tag: 'None' }constructorssome
Source effect/Option.ts:2591 lines
export const const none: <A = never>() => Option<A>Creates an Option representing the absence of a value.
When to use
Use to represent a missing or uninitialized value, such as returning "no
result" from a function.
Details
- Returns
Option<never>, which is a subtype of Option<A> for any A
- Always returns the same singleton instance
Example (Creating an empty Option)
import { Option } from "effect"
// ┌─── Option<never>
// ▼
const noValue = Option.none()
console.log(noValue)
// Output: { _id: 'Option', _tag: 'None' }
none = <function (type parameter) A in <A = never>(): Option<A>A = never>(): 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<function (type parameter) A in <A = never>(): Option<A>A> => import optionoption.const none: Option.Option<never>noneReferenced by 94 symbols
Array.dedupeAdjacentWithArray.findFirstIndexArray.findFirstWithIndexArray.findLastArray.findLastIndexArray.getArray.initArray.insertAtArray.lastArray.modifyArray.tailBigDecimal.divideBigDecimal.fromNumberBigDecimal.fromStringBigDecimal.remainderBigInt.divideBigInt.fromNumberBigInt.fromStringBigInt.sqrtBigInt.toNumberChannel.acquireUseReleaseChannel.fromIteratorArrayChannel.runHeadChannel.splitLinesChunk.ChunkChunk.getChunk.tailConfig.optionContext.ReferenceContext.getOptionDuration.divideFiberHandle.getUnsafeFiberMap.getUnsafeFilter.toOptionGraph.astarGraph.bellmanFordGraph.dijkstraGraph.findEdgeGraph.findNodeGraph.getNode+54 more