ts-essentials#Tuple TypeScript Examples
The following examples show how to use
ts-essentials#Tuple.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: functions.ts From rubic-sdk with GNU General Public License v3.0 | 6 votes |
export async function tryExecuteAsync<T extends Tuple, R>(
func: (...args: T) => Promise<R>,
parameters: Parameters<typeof func>
): Promise<SuccessfulCall<R> | ErrorCall> {
try {
const value = await func(...parameters);
return {
success: true,
value
};
} catch (error) {
return {
success: false,
error
};
}
}