Skip to content

Instantly share code, notes, and snippets.

Last active May 31, 2022
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 <> (
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