Skip to content

Interface: Ok<T>

Defined in: index.ts:27

Represents a successful result containing data.

This interface is part of a discriminated union with Err to create the Result type. Use the ok() function to create instances rather than constructing manually.

Example

typescript
const result: Ok<string> = ok("Hello");
console.log(result.success); // true
console.log(result.data); // "Hello"

Type Parameters

T

T = any

The type of the success data

Properties

data

readonly data: T

Defined in: index.ts:29


success

readonly success: true

Defined in: index.ts:28