Last active
January 6, 2021 17:10
-
-
Save aleksejkozin/b7b7ddcabfffdb784cdf0f0f8ce096f9 to your computer and use it in GitHub Desktop.
This file contains 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
const call = async <T>(fn: Promise<T> | (() => T)): Promise<void> => { | |
if (typeof fn === 'function') { | |
fn() | |
} else { | |
await fn | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment