TypeScript provides the import
and export
keywords as language-standard mechanisms for module management. Javascript's
require()
usages should be converted to the new syntax.
// circle.js module.exports = function (r) { return PI * r * r; }; // foo.js const circle = require('./circle.js'); // Noncompliant
// circle.ts export default function (r) { return PI * r * r; } // foo.ts import circle from "./circle.ts"