A module setting is a TypeScript compiler option in tsconfig.json that selects the module format emitted for a project. It determines how imports and exports appear in generated JavaScript, helping the output match its runtime or delivery toolchain. section 5.8.1
For Node.js projects, Node16 uses the type property in package.json, or the .mts and .cts extensions, to determine the module format. This reduces mismatches between TypeScript output and Node.js behavior. section 5.8.1 section 15.1
Node16 configuration
In tsconfig.json, configure a Node.js-oriented project with "module": "Node16". With package.json containing "type": "module", an import such as import { sum } from "./calc.js" remains an ECMAScript module import. Changing package.json to "type": "commonjs" causes the compiler to emit CommonJS code using require instead.
Web applications often receive their module-format decision from a framework toolchain, bundler, or module loader. The module setting may be omitted when defaults are suitable, but explicitly selecting Node16 makes the runtime relationship clearer. section 5.8.1
