0
# @tsconfig/node-lts
1
2
@tsconfig/node-lts provides a curated TypeScript configuration base specifically designed for Node.js LTS (Long Term Support) versions. It offers a standardized tsconfig.json setup that developers can extend in their projects, featuring optimized compiler options including ES2023 library support, Node16 module resolution, ES2022 target compilation, and strict type checking enabled.
3
4
## Package Information
5
6
- **Package Name**: @tsconfig/node-lts
7
- **Package Type**: npm
8
- **Language**: JSON (TypeScript Configuration)
9
- **Installation**: `npm install --save-dev @tsconfig/node-lts`
10
11
## Core Imports
12
13
This package is used through TypeScript configuration inheritance, not code imports:
14
15
```json
16
{
17
"extends": "@tsconfig/node-lts/tsconfig.json"
18
}
19
```
20
21
## Basic Usage
22
23
1. Install the package as a dev dependency:
24
25
```bash
26
npm install --save-dev @tsconfig/node-lts
27
```
28
29
2. Create or update your project's `tsconfig.json`:
30
31
```json
32
{
33
"extends": "@tsconfig/node-lts/tsconfig.json",
34
"compilerOptions": {
35
// Your project-specific overrides
36
"outDir": "./dist",
37
"rootDir": "./src"
38
},
39
"include": ["src/**/*"],
40
"exclude": ["node_modules", "dist"]
41
}
42
```
43
44
3. The configuration will automatically apply Node.js LTS-optimized settings to your TypeScript compilation.
45
46
## Capabilities
47
48
### TypeScript Configuration Extension
49
50
Provides a base TypeScript configuration optimized for Node.js LTS versions that can be extended in project tsconfig.json files.
51
52
```json { .api }
53
{
54
"$schema": "https://json.schemastore.org/tsconfig",
55
"display": "Node LTS",
56
"_version": "20.1.0",
57
"compilerOptions": {
58
"lib": ["es2023"],
59
"module": "node16",
60
"target": "es2022",
61
"strict": true,
62
"esModuleInterop": true,
63
"skipLibCheck": true,
64
"moduleResolution": "node16"
65
}
66
}
67
```
68
69
### Compiler Options Configuration
70
71
The package configures the following TypeScript compiler options:
72
73
#### Library Support
74
75
```json { .api }
76
{
77
"lib": ["es2023"]
78
}
79
```
80
81
Enables ES2023 standard library definitions, providing access to the latest JavaScript features supported by Node.js LTS.
82
83
#### Module System Configuration
84
85
```json { .api }
86
{
87
"module": "node16",
88
"moduleResolution": "node16"
89
}
90
```
91
92
- **module**: Sets module system to `node16` for Node.js 16+ compatibility
93
- **moduleResolution**: Uses Node.js 16+ module resolution algorithm supporting both CommonJS and ESM
94
95
#### Compilation Target
96
97
```json { .api }
98
{
99
"target": "es2022"
100
}
101
```
102
103
Targets ES2022 JavaScript features, optimized for Node.js LTS runtime capabilities.
104
105
#### Type Checking Configuration
106
107
```json { .api }
108
{
109
"strict": true,
110
"esModuleInterop": true,
111
"skipLibCheck": true
112
}
113
```
114
115
- **strict**: Enables all strict type checking options for maximum type safety
116
- **esModuleInterop**: Allows default imports from CommonJS modules
117
- **skipLibCheck**: Skips type checking of declaration files for improved build performance
118
119
### Schema Validation
120
121
```json { .api }
122
{
123
"$schema": "https://json.schemastore.org/tsconfig"
124
}
125
```
126
127
Provides JSON schema reference for IDE validation and IntelliSense support in TypeScript configuration files.
128
129
### Version Tracking
130
131
```json { .api }
132
{
133
"_version": "20.1.0"
134
}
135
```
136
137
Internal version identifier for the configuration template.
138
139
## Usage Examples
140
141
### Basic Project Setup
142
143
```json
144
{
145
"extends": "@tsconfig/node-lts/tsconfig.json",
146
"compilerOptions": {
147
"outDir": "./build",
148
"declaration": true
149
},
150
"include": ["src/**/*"]
151
}
152
```
153
154
### Multiple Configuration Extension (TypeScript 5.0+)
155
156
```json
157
{
158
"extends": [
159
"@tsconfig/strictest/tsconfig.json",
160
"@tsconfig/node-lts/tsconfig.json"
161
],
162
"compilerOptions": {
163
"outDir": "./dist"
164
}
165
}
166
```
167
168
### Override Specific Options
169
170
```json
171
{
172
"extends": "@tsconfig/node-lts/tsconfig.json",
173
"compilerOptions": {
174
"target": "es2020",
175
"moduleResolution": "node",
176
"baseUrl": ".",
177
"paths": {
178
"@/*": ["src/*"]
179
}
180
}
181
}
182
```
183
184
## Integration Points
185
186
### TypeScript Compiler Integration
187
188
The configuration is consumed by:
189
- `tsc` command for compilation
190
- TypeScript language server for IDE support
191
- Build tools that process TypeScript (webpack, rollup, etc.)
192
193
### IDE Support
194
195
Provides automatic configuration for:
196
- Visual Studio Code TypeScript support
197
- WebStorm/IntelliJ TypeScript service
198
- Other editors with TypeScript language server integration
199
200
### Build System Compatibility
201
202
Compatible with popular Node.js build systems:
203
- Native TypeScript compiler
204
- ts-node for development
205
- Bundlers like webpack, rollup, esbuild
206
- Test runners like Jest, Vitest
207
- Development servers like nodemon with ts-node
208
209
## Error Handling
210
211
### Configuration Validation Errors
212
213
TypeScript will report configuration errors if:
214
- Invalid compiler options are specified
215
- Conflicting module system settings are used
216
- Incompatible target/lib combinations are set
217
218
### Runtime Compatibility
219
220
The configuration ensures compatibility with Node.js LTS versions. Using features not supported by the target Node.js version may result in runtime errors despite successful compilation.
221
222
## Advanced Usage
223
224
### Custom Library Extensions
225
226
```json
227
{
228
"extends": "@tsconfig/node-lts/tsconfig.json",
229
"compilerOptions": {
230
"lib": ["es2023", "dom"]
231
}
232
}
233
```
234
235
### Path Mapping Configuration
236
237
```json
238
{
239
"extends": "@tsconfig/node-lts/tsconfig.json",
240
"compilerOptions": {
241
"baseUrl": ".",
242
"paths": {
243
"@core/*": ["src/core/*"],
244
"@utils/*": ["src/utils/*"]
245
}
246
}
247
}
248
```
249
250
### Monorepo Configuration
251
252
```json
253
{
254
"extends": "@tsconfig/node-lts/tsconfig.json",
255
"references": [
256
{ "path": "./packages/core" },
257
{ "path": "./packages/utils" }
258
]
259
}
260
```