This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type SuccessResult<T> = readonly [T, null]; | |
type ErrorResult<E = Error> = readonly [null, E]; | |
type Result<T, E = Error> = SuccessResult<T> | ErrorResult<E>; | |
const tryCatch = async <T, E = Error>( | |
promise: Promise<T> | |
): Promise<Result<T, E>> => { | |
try { | |
const result = await promise; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"tabWidth": 2, | |
"useTabs": false, | |
"semi": true, | |
"singleQuote": true, | |
"jsxSingleQuote": true, | |
"singleAttributePerLine": true, | |
"trailingComma": "all" | |
} |