Creates a Result.Ok containing the given success value.
Result.Ok
Use this constructor when an operation succeeds and you want to wrap the successful result in a Result type for consistent error handling.
The type of the success value.
The success value.
A Result.Ok<S> containing the value.
Result.Ok<S>
const success = Result.ok({ id: 1 });const failure = Result.err(new Error('missing data'));assert.deepStrictEqual(success, { $$tag: 'ts-data-forge::Result.ok', value: { id: 1 },});assert.ok(Result.isErr(failure)); Copy
const success = Result.ok({ id: 1 });const failure = Result.err(new Error('missing data'));assert.deepStrictEqual(success, { $$tag: 'ts-data-forge::Result.ok', value: { id: 1 },});assert.ok(Result.isErr(failure));
Creates a
Result.Ok
containing the given success value.Use this constructor when an operation succeeds and you want to wrap the successful result in a Result type for consistent error handling.