Skip to content

API Reference / @gtkx/runtime / trimFinish

Variable: trimFinish

const trimFinish: <R, T>(finish) => FinishResult<R, TrimmedFinish<T>>

Defined in: packages/runtime/dist/promisify.d.ts:17

Wraps a finish function whose result leads with the success boolean of a throwing C call, dropping that boolean: failure already surfaces as a thrown error, so the boolean is always true. A single remaining value is handed back bare, several stay a tuple. The finish result must carry at least one value beyond the boolean; a boolean-only finish needs no trimming.

Type Parameters

R

R extends object

T

T extends readonly [boolean, unknown, ...unknown[]]

Parameters

finish

FinishResult<R, T>

Extracts the boolean-led result from the async result passed to the completion callback.

Returns

FinishResult<R, TrimmedFinish<T>>

A finish function resolving to the result without its leading boolean.

Released under the MPL-2.0 License.