interop
Making two systems work together, such as ES modules importing CommonJS packages.
In more detail
Node.js lets ES modules import CommonJS through a default import, and recent versions can also require ES modules. TypeScript's NodeNext settings model these rules so mismatches show up as compile errors.
Related terms
- CommonJS — Node.js's original module system, which loads code with require() and exports it with module.exports.
- ECMAScript modules — The standard JavaScript module system, written with import and export statements, used by browsers and modern tools.
- NodeNext — A module and moduleResolution setting that makes TypeScript follow exactly the module rules of current Node.js.
Taught in
- ECMAScript Modules, CJS Interop And verbatimModuleSyntax — Production TypeScript