Created
September 20, 2022 17:10
-
-
Save erikunha/4fdcc1cab8ed8256405cf93b5b87249e to your computer and use it in GitHub Desktop.
Named component
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
export const namedComponent = async <T, N extends keyof T>( | |
modPromise: Promise<T>, | |
exportName: N, | |
) => { | |
const mod = await modPromise; | |
return mod[exportName]; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment