Skip to content

Instantly share code, notes, and snippets.

@dimaslanjaka
Last active May 31, 2022
Embed
What would you like to do?
How to use require in typescript
export default function anyFunc() {
return 'hello world';
}
/// <reference path="./require.d.ts" />
// hanya untuk type
import func from './func';
console.log(require<typeof func>('./func'));
/**
* 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