method AsyncResult.prototype.match AsyncResult.prototype.match<U>(pattern: { ok: (value: T) => U; err: (error: E) => U; }): Promise<U> Pattern matching for async Results. Examples Example 1 const message = await fetchUser("123").match({ ok: (user) => `Welcome, ${user.name}`, err: (error) => `Error: ${error.message}` }); Type Parameters U The type of the return value Parameters pattern: { ok: (value: T) => U; err: (error: E) => U; } Object with ok and err handler functions Return Type Promise<U> Promise of the result from calling either handler