For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /api/types/Option.InferSome.md.

Type Alias: InferSome<T>

InferSome<T> = [T] extends [(...args) => OptionMaybeAsync<infer U>] ? U : [T] extends [OptionMaybeAsync<infer U>] ? U : never

Infers the Some value type T from an Option or a function returning an Option.

Type Parameters

T

T

An OptionMaybeAsync type or a function returning it.

Example

import { 
import Option
Option
} from 'byenull';
type
type A = number
A
=
import Option
Option
.
type InferSome<T> = [T] extends [(...args: any[]) => Option.OptionMaybeAsync<infer U>] ? U : [T] extends [Option.OptionMaybeAsync<infer U>] ? U : never

Infers the Some value type T from an Option or a function returning an Option.

@typeParamT - An OptionMaybeAsync type or a function returning it.@example
import { Option } from 'byenull';

type A = Option.InferSome<Option.Option<number>>; // number
type B = Option.InferSome<Option.OptionAsync<number>>; // number
type C = Option.InferSome<() => Option.Option<number>>; // number
@categoryInfer Types
InferSome
<
import Option
Option
.
type Option<T> = Option.Some<T> | Option.None

A union type representing either a Some or a None .

@typeParamT - The type of the Some value.@example
import { Option } from 'byenull';

const doSomething = (): Option.Option<number> => {
  return Math.random() > 0.5
    ? Option.some(10)
    : Option.none();
};
@categoryCore Types
Option
<number>>; // number
type
type B = number
B
=
import Option
Option
.
type InferSome<T> = [T] extends [(...args: any[]) => Option.OptionMaybeAsync<infer U>] ? U : [T] extends [Option.OptionMaybeAsync<infer U>] ? U : never

Infers the Some value type T from an Option or a function returning an Option.

@typeParamT - An OptionMaybeAsync type or a function returning it.@example
import { Option } from 'byenull';

type A = Option.InferSome<Option.Option<number>>; // number
type B = Option.InferSome<Option.OptionAsync<number>>; // number
type C = Option.InferSome<() => Option.Option<number>>; // number
@categoryInfer Types
InferSome
<
import Option
Option
.
type OptionAsync<T> = Promise<Option.Option<T>>

An asynchronous variant of Option , wrapped in a Promise.

@typeParamT - The type of the Some value.@categoryCore Types
OptionAsync
<number>>; // number
type
type C = number
C
=
import Option
Option
.
type InferSome<T> = [T] extends [(...args: any[]) => Option.OptionMaybeAsync<infer U>] ? U : [T] extends [Option.OptionMaybeAsync<infer U>] ? U : never

Infers the Some value type T from an Option or a function returning an Option.

@typeParamT - An OptionMaybeAsync type or a function returning it.@example
import { Option } from 'byenull';

type A = Option.InferSome<Option.Option<number>>; // number
type B = Option.InferSome<Option.OptionAsync<number>>; // number
type C = Option.InferSome<() => Option.Option<number>>; // number
@categoryInfer Types
InferSome
<() =>
import Option
Option
.
type Option<T> = Option.Some<T> | Option.None

A union type representing either a Some or a None .

@typeParamT - The type of the Some value.@example
import { Option } from 'byenull';

const doSomething = (): Option.Option<number> => {
  return Math.random() > 0.5
    ? Option.some(10)
    : Option.none();
};
@categoryCore Types
Option
<number>>; // number