Result type, this type contains types for both Ok and Err
Type of the return value, default is unknown
Type of the error, default is unknown
async function action(): Promise<IResult<number>> {try { return Ok(await getNumber());} catch (e: unknown) { return Err(e);}const result = await action();if (result.isOk) { console.log('Result: ' + result.ok());} else { console.log('Error: ', result.err());} Copy
async function action(): Promise<IResult<number>> {try { return Ok(await getNumber());} catch (e: unknown) { return Err(e);}const result = await action();if (result.isOk) { console.log('Result: ' + result.ok());} else { console.log('Error: ', result.err());}
v1.0.0
Result type, this type contains types for both Ok and Err