A base TSConfig for working with Node 12.
npx @tessl/cli install tessl/npm-tsconfig--node12@12.1.00
# @tsconfig/node12
1
2
@tsconfig/node12 provides a base TypeScript configuration optimized for Node.js 12 runtime environments. It defines compiler options that align with Node 12's JavaScript capabilities, ensuring strict type checking while maintaining compatibility with Node 12's module system and available ECMAScript features.
3
4
## Package Information
5
6
- **Package Name**: @tsconfig/node12
7
- **Package Type**: npm
8
- **Language**: TypeScript (Configuration)
9
- **Installation**: `npm install --save-dev @tsconfig/node12`
10
11
## Core Imports
12
13
This package is consumed through TypeScript configuration extension rather than code imports:
14
15
```json
16
{
17
"extends": "@tsconfig/node12/tsconfig.json"
18
}
19
```
20
21
## Basic Usage
22
23
```bash
24
# Install the package
25
npm install --save-dev @tsconfig/node12
26
```
27
28
```json
29
// tsconfig.json
30
{
31
"extends": "@tsconfig/node12/tsconfig.json",
32
"compilerOptions": {
33
// Your additional or overridden options
34
"outDir": "./dist",
35
"baseUrl": "./src"
36
}
37
}
38
```
39
40
## Architecture
41
42
@tsconfig/node12 follows the TSConfig base pattern where:
43
44
- **Base Configuration**: Provides sensible defaults for Node.js 12 environments
45
- **Extension Pattern**: Consumed via `extends` property in user tsconfig.json files
46
- **Override Support**: All settings can be overridden or supplemented by consuming projects
47
- **Version Alignment**: Configuration options aligned with Node.js 12 capabilities and JavaScript feature support
48
49
## Capabilities
50
51
### TypeScript Configuration Base
52
53
The main configuration object that provides Node.js 12-optimized TypeScript compiler settings.
54
55
```json { .api }
56
{
57
"$schema": "https://json.schemastore.org/tsconfig",
58
"display": "Node 12",
59
"_version": "12.1.0",
60
"compilerOptions": {
61
"lib": ["es2019", "es2020.promise", "es2020.bigint", "es2020.string"],
62
"module": "node16",
63
"target": "es2019",
64
"strict": true,
65
"esModuleInterop": true,
66
"skipLibCheck": true,
67
"moduleResolution": "node16"
68
}
69
}
70
```
71
72
### Configuration Properties
73
74
#### Schema Reference
75
76
JSON schema reference for TypeScript configuration validation.
77
78
```json { .api }
79
{
80
"$schema": "https://json.schemastore.org/tsconfig"
81
}
82
```
83
84
#### Display Name
85
86
Human-readable display name for this configuration.
87
88
```json { .api }
89
{
90
"display": "Node 12"
91
}
92
```
93
94
#### Version Identifier
95
96
Internal version identifier for this configuration base.
97
98
```json { .api }
99
{
100
"_version": "12.1.0"
101
}
102
```
103
104
#### Compiler Options
105
106
Core TypeScript compiler configuration optimized for Node.js 12.
107
108
```json { .api }
109
{
110
"compilerOptions": {
111
"lib": string[],
112
"module": string,
113
"target": string,
114
"strict": boolean,
115
"esModuleInterop": boolean,
116
"skipLibCheck": boolean,
117
"moduleResolution": string
118
}
119
}
120
```
121
122
### Library Definitions
123
124
JavaScript language features available in Node.js 12 environment.
125
126
```json { .api }
127
{
128
"lib": ["es2019", "es2020.promise", "es2020.bigint", "es2020.string"]
129
}
130
```
131
132
**Features included:**
133
- `es2019`: Core ES2019 features (Array.flat, Object.fromEntries, etc.)
134
- `es2020.promise`: Promise.allSettled and related Promise features
135
- `es2020.bigint`: BigInt support for large integer operations
136
- `es2020.string`: String.matchAll and related string methods
137
138
### Module Configuration
139
140
Module system and resolution settings for Node.js compatibility.
141
142
```json { .api }
143
{
144
"module": "node16",
145
"moduleResolution": "node16"
146
}
147
```
148
149
### Compilation Target
150
151
ECMAScript target version matching Node.js 12 capabilities.
152
153
```json { .api }
154
{
155
"target": "es2019"
156
}
157
```
158
159
### Type Checking Options
160
161
Strict type checking and interoperability settings.
162
163
```json { .api }
164
{
165
"strict": true,
166
"esModuleInterop": true,
167
"skipLibCheck": true
168
}
169
```
170
171
**Settings explained:**
172
- `strict`: Enables all strict type checking options for maximum type safety
173
- `esModuleInterop`: Enables interoperability between CommonJS and ES modules
174
- `skipLibCheck`: Skips type checking of declaration files for faster compilation
175
176
## Types
177
178
### TSConfig Schema
179
180
The complete TypeScript configuration structure that can be extended.
181
182
```typescript { .api }
183
interface TSConfig {
184
$schema?: string;
185
display?: string;
186
_version?: string;
187
compilerOptions: CompilerOptions;
188
extends?: string | string[];
189
// Additional tsconfig properties can be added by extending projects
190
}
191
192
interface CompilerOptions {
193
lib?: string[];
194
module?: string;
195
target?: string;
196
strict?: boolean;
197
esModuleInterop?: boolean;
198
skipLibCheck?: boolean;
199
moduleResolution?: string;
200
// Additional compiler options can be added by extending projects
201
}
202
```
203
204
## Usage Examples
205
206
### Basic Extension
207
208
```json
209
{
210
"extends": "@tsconfig/node12/tsconfig.json"
211
}
212
```
213
214
### Extension with Overrides
215
216
```json
217
{
218
"extends": "@tsconfig/node12/tsconfig.json",
219
"compilerOptions": {
220
"outDir": "./dist",
221
"baseUrl": "./src",
222
"paths": {
223
"@/*": ["./src/*"]
224
}
225
},
226
"include": ["src/**/*"],
227
"exclude": ["node_modules", "dist"]
228
}
229
```
230
231
### Multiple Configuration Extension
232
233
Since TypeScript 5.0+, you can extend from multiple configurations:
234
235
```json
236
{
237
"extends": [
238
"@tsconfig/node12/tsconfig.json",
239
"@tsconfig/strictest/tsconfig.json"
240
]
241
}
242
```
243
244
### Project-Specific Customization
245
246
```json
247
{
248
"extends": "@tsconfig/node12/tsconfig.json",
249
"compilerOptions": {
250
"outDir": "./build",
251
"baseUrl": ".",
252
"paths": {
253
"~/*": ["./src/*"]
254
},
255
"declaration": true,
256
"declarationMap": true
257
},
258
"include": [
259
"src/**/*.ts",
260
"types/**/*.ts"
261
],
262
"exclude": [
263
"node_modules",
264
"build",
265
"**/*.test.ts"
266
]
267
}
268
```