What is @tsconfig/node12?
@tsconfig/node12 is a TypeScript configuration preset specifically tailored for Node.js version 12. It provides a set of default TypeScript compiler options that are optimized for developing Node.js applications using TypeScript.
What are @tsconfig/node12's main functionalities?
TypeScript Configuration Preset
This feature allows you to extend the default TypeScript configuration for Node.js 12 by simply referencing the preset in your `tsconfig.json` file. This simplifies the setup process and ensures that your TypeScript configuration is optimized for Node.js 12.
{
"extends": "@tsconfig/node12/tsconfig.json"
}
Node.js 12 Compatibility
The configuration preset includes compiler options that are compatible with Node.js 12, such as targeting ES2019 and using the CommonJS module system. This ensures that your TypeScript code is transpiled in a way that is compatible with the features and capabilities of Node.js 12.
{
"compilerOptions": {
"lib": ["es2019"],
"module": "commonjs",
"target": "es2019"
}
}
Other packages similar to @tsconfig/node12
@tsconfig/node14
@tsconfig/node14 is a TypeScript configuration preset for Node.js version 14. It provides a similar set of default TypeScript compiler options optimized for Node.js 14, including support for newer JavaScript features available in ES2020.
@tsconfig/node10
@tsconfig/node10 is a TypeScript configuration preset for Node.js version 10. It offers a set of default TypeScript compiler options tailored for Node.js 10, ensuring compatibility with the features and limitations of that version.
@tsconfig/recommended
@tsconfig/recommended is a general-purpose TypeScript configuration preset that provides a set of recommended compiler options for most TypeScript projects. It is not specific to any Node.js version but offers a good starting point for TypeScript development.
A base TSConfig for working with Node 12.
Add the package to your "devDependencies"
:
npm install --save-dev @tsconfig/node12
yarn add --dev @tsconfig/node12
Add to your tsconfig.json
:
"extends": "@tsconfig/node12/tsconfig.json"
The tsconfig.json
:
{
"$schema": "https://json.schemastore.org/tsconfig",
"_version": "12.1.0",
"compilerOptions": {
"lib": ["es2019", "es2020.promise", "es2020.bigint", "es2020.string"],
"module": "node16",
"target": "es2019",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"moduleResolution": "node16"
}
}
You can find the code here.