Visit my blog https://www.webmanajemen.com/
Last active
May 31, 2022 01:10
-
-
Save dimaslanjaka/e7fc4c8778cdef48e1799de74a0c8949 to your computer and use it in GitHub Desktop.
How to use require in typescript
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
export default function anyFunc() { | |
return 'hello world'; | |
} |
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
/// <reference path="./require.d.ts" /> | |
// hanya untuk type | |
import func from './func'; | |
console.log(require<typeof func>('./func')); |
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
/** | |
* env~node require mirror | |
* @author Dimas Lanjaka <dimaslanjaka@gmail.com> (https://www.webmanajemen.com) | |
*/ | |
declare function require<T = any>(name: string): T; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment