To use Node.js require inside TypeScript file, we call require
with import
or use the import
statement.
For instance, we write
import sampleModule = require("module-name");
to require the module-name
module with require
and import
.
Or we write
import * as sampleModule from "module-name";
to import the module-name
module as a default import.