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

# Type Alias: ResultFor\<R, T, E>

> **ResultFor**\<`R`, `T`, `E`> = `true` _extends_ `HasPromise`\<`R`> ? [`ResultAsync`](/byethrow/ja/api/types/Result.ResultAsync.md)\<`T`, `E`> : [`Result`](/byethrow/ja/api/types/Result.Result.md)\<`T`, `E`>

Resolves to the appropriate Result type (sync or async) based on the input type.

Typically used to conditionally infer return types based on whether the original computation was async.

## Type Parameters

### R

`R`

The reference type to inspect for a Promise.

### T

`T`

The type of the [Success](/byethrow/ja/api/types/Result.Success.md) value.

### E

`E`

The type of the [Failure](/byethrow/ja/api/types/Result.Failure.md) value.

## Examples

**With a Promise-returning function**

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

type R = Result.ResultAsync<number, string>;
type Output = Result.ResultFor<R, number, string>; // Result.ResultAsync<number, string>
```

**With a non-Promise-returning function**

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

type R = Result.Result<number, string>;
type Output = Result.ResultFor<R, number, string>; // Result.Result<number, string>
```
