headOrElse
Retrieves the first element of a ReadonlyArray
.
If the array is empty, it returns the fallback
argument if provided; otherwise, it fails.
Since
3.10.0
Call Signature
headOrElse<
S
,A
>(fallback
?): (self
) =>transform
<S
,SchemaClass
<A
[number
],A
[number
],never
>>
Defined in: node_modules/.pnpm/effect@3.14.8/node_modules/effect/dist/dts/Schema.d.ts:3454
Retrieves the first element of a ReadonlyArray
.
If the array is empty, it returns the fallback
argument if provided; otherwise, it fails.
Type Parameters
• S extends Any
• A extends readonly unknown
[]
Parameters
fallback?
LazyArg
<A
[number
]>
Returns
Function
Parameters
self
S
& Schema
<A
, Encoded
<S
>, Context
<S
>>
Returns
transform
<S
, SchemaClass
<A
[number
], A
[number
], never
>>
Since
3.10.0
Since
3.10.0
Call Signature
headOrElse<
S
,A
>(self
,fallback
?):transform
<S
,SchemaClass
<A
[number
],A
[number
],never
>>
Defined in: node_modules/.pnpm/effect@3.14.8/node_modules/effect/dist/dts/Schema.d.ts:3463
Retrieves the first element of a ReadonlyArray
.
If the array is empty, it returns the fallback
argument if provided; otherwise, it fails.
Type Parameters
• S extends Any
• A extends readonly unknown
[]
Parameters
self
S
& Schema
<A
, Encoded
<S
>, Context
<S
>>
fallback?
LazyArg
<A
[number
]>
Returns
transform
<S
, SchemaClass
<A
[number
], A
[number
], never
>>
Since
3.10.0
Since
3.10.0