> For AI agents: the complete documentation index is available at /byethrow/llms.txt, the full documentation bundle is available at /byethrow/llms-full.txt.

# Type Alias: InferSuccess\<T>

> **InferSuccess**\<`T`> = \[`T`] _extends_ \[(...`args`) => [`ResultMaybeAsync`](/byethrow/api/types/Result.ResultMaybeAsync.md)\<infer U, `any`>] ? `U` : \[`T`] _extends_ \[[`ResultMaybeAsync`](/byethrow/api/types/Result.ResultMaybeAsync.md)\<infer U, `any`>] ? `U` : `never`

Infers the [Success](/byethrow/api/types/Result.Success.md) value type `T` from a Result or a function returning a Result.

## Type Parameters

### T

`T`

A [ResultMaybeAsync](/byethrow/api/types/Result.ResultMaybeAsync.md) type or a function returning it.

## Examples

**From a result object**

```ts
import { Result } from '@praha/byethrow';

type R = Result.Result<number, string>;
type SuccessValue = Result.InferSuccess<R>; // number
```

**From a function**

```ts
import { Result } from '@praha/byethrow';

const fn = () => Promise.resolve({ type: 'Success', value: 123 } as const);
type SuccessValue = Result.InferSuccess<typeof fn>; // number
```
