Centralized recommendations for TSConfig bases - pre-configured TypeScript configurations for various runtime environments
pkg:github/tsconfig/bases
npx @tessl/cli install tessl/npm-tsconfig--bases@1.0.00
# TSConfig Bases
1
2
TSConfig Bases provides centralized recommendations for TypeScript compiler configurations, hosting pre-configured TSConfig files for various runtime environments. It's the "Definitely Typed for TSConfigs" - a community-owned collection of base configurations that you can extend in your TypeScript projects.
3
4
## Package Information
5
6
- **Package Name**: tsconfig/bases (GitHub repository)
7
- **Package Type**: npm (multiple scoped packages)
8
- **Language**: TypeScript/JSON
9
- **Installation**: Individual packages like `npm install --save-dev @tsconfig/node18`
10
11
## Core Imports
12
13
TSConfig bases are extended in your `tsconfig.json` rather than imported:
14
15
```json
16
{
17
"extends": "@tsconfig/recommended/tsconfig.json"
18
}
19
```
20
21
Multiple configurations can be extended since TypeScript 5.0:
22
23
```json
24
{
25
"extends": ["@tsconfig/strictest/tsconfig", "@tsconfig/node18/tsconfig"]
26
}
27
```
28
29
## Basic Usage
30
31
```json
32
{
33
"extends": "@tsconfig/node18/tsconfig.json",
34
"compilerOptions": {
35
"outDir": "./dist",
36
"rootDir": "./src"
37
},
38
"include": ["src/**/*"],
39
"exclude": ["node_modules", "dist"]
40
}
41
```
42
43
## Architecture
44
45
TSConfig Bases uses a template-based generation system:
46
47
- **Base Configurations**: JSON files in `/bases` directory defining compiler options
48
- **Template System**: Generates individual npm packages from base configurations
49
- **Automated Publishing**: GitHub Actions deploy changed bases automatically
50
- **Community Driven**: Owned and improved by the TypeScript community
51
52
## Capabilities
53
54
### Available Base Configurations
55
56
The ecosystem provides 25+ pre-configured TypeScript configurations for different runtime environments.
57
58
```typescript { .api }
59
interface BaseConfiguration {
60
$schema: string;
61
display: string;
62
_version?: string;
63
compilerOptions: CompilerOptions;
64
}
65
66
interface CompilerOptions {
67
target?: string;
68
module?: string;
69
lib?: string[];
70
strict?: boolean;
71
esModuleInterop?: boolean;
72
skipLibCheck?: boolean;
73
moduleResolution?: string;
74
[key: string]: any;
75
}
76
```
77
78
**Popular Base Configurations:**
79
80
- `@tsconfig/recommended` - General TypeScript recommendations
81
- `@tsconfig/node18` - Node.js 18 environment
82
- `@tsconfig/react-native` - React Native development
83
- `@tsconfig/next` - Next.js applications
84
- `@tsconfig/strictest` - Maximum type safety
85
- `@tsconfig/create-react-app` - Create React App projects
86
87
### Node.js Environments
88
89
Specialized configurations for different Node.js versions with appropriate targets and module systems.
90
91
```json { .api }
92
{
93
"$schema": "https://json.schemastore.org/tsconfig",
94
"display": "Node 18",
95
"_version": "18.2.0",
96
"compilerOptions": {
97
"lib": ["es2023"],
98
"module": "node16",
99
"target": "es2022",
100
"strict": true,
101
"esModuleInterop": true,
102
"skipLibCheck": true,
103
"moduleResolution": "node16"
104
}
105
}
106
```
107
108
**Available Node Configurations:**
109
- `@tsconfig/node-lts` - Latest LTS version
110
- `@tsconfig/node10` through `@tsconfig/node21` - Specific versions
111
- Each optimized for the target Node.js runtime capabilities
112
113
### Framework-Specific Configurations
114
115
Pre-configured setups for popular frameworks and tools.
116
117
```json { .api }
118
{
119
"$schema": "https://json.schemastore.org/tsconfig",
120
"display": "Create React App",
121
"_version": "2.0.0",
122
"compilerOptions": {
123
"lib": ["dom", "dom.iterable", "esnext"],
124
"module": "esnext",
125
"moduleResolution": "bundler",
126
"target": "es2015",
127
"allowJs": true,
128
"allowSyntheticDefaultImports": true,
129
"esModuleInterop": true,
130
"isolatedModules": true,
131
"jsx": "react-jsx",
132
"noEmit": true,
133
"noFallthroughCasesInSwitch": true,
134
"resolveJsonModule": true,
135
"skipLibCheck": true,
136
"strict": true
137
}
138
}
139
```
140
141
**Framework Configurations:**
142
- `@tsconfig/create-react-app` - Create React App setup
143
- `@tsconfig/next` - Next.js applications
144
- `@tsconfig/nuxt` - Nuxt.js applications
145
- `@tsconfig/react-native` - React Native development
146
- `@tsconfig/svelte` - Svelte applications
147
- `@tsconfig/remix` - Remix applications
148
149
### Runtime-Specific Configurations
150
151
Configurations optimized for specific JavaScript runtimes and environments.
152
153
```json { .api }
154
{
155
"$schema": "https://json.schemastore.org/tsconfig",
156
"display": "Deno",
157
"compilerOptions": {
158
"jsx": "react",
159
"lib": [],
160
"resolveJsonModule": true,
161
"strict": true
162
}
163
}
164
```
165
166
**Runtime Configurations:**
167
- `@tsconfig/deno` - Deno runtime
168
- `@tsconfig/bun` - Bun runtime
169
- `@tsconfig/cypress` - Cypress testing
170
- `@tsconfig/docusaurus` - Docusaurus documentation
171
172
### Configuration Extension System
173
174
All base configurations support TypeScript's extends mechanism for customization.
175
176
```typescript { .api }
177
interface ExtendedConfiguration {
178
extends: string | string[];
179
compilerOptions?: Partial<CompilerOptions>;
180
include?: string[];
181
exclude?: string[];
182
files?: string[];
183
}
184
```
185
186
**Extension Examples:**
187
188
```json
189
{
190
"extends": "@tsconfig/node18/tsconfig.json",
191
"compilerOptions": {
192
"outDir": "./build",
193
"sourceMap": true,
194
"declaration": true
195
}
196
}
197
```
198
199
**Multiple Extension (TypeScript 5.0+):**
200
201
```json
202
{
203
"extends": ["@tsconfig/strictest/tsconfig", "@tsconfig/node18/tsconfig"]
204
}
205
```
206
207
### Package Generation System
208
209
The repository uses automated scripts to generate individual npm packages from base configurations.
210
211
```typescript { .api }
212
interface PackageGeneration {
213
createNpmPackages(): void;
214
deployChangedPackages(): void;
215
generateRecommended(): void;
216
updateMarkdownReadme(): void;
217
}
218
219
interface BaseFile {
220
name: string;
221
display: string;
222
_version?: string;
223
compilerOptions: CompilerOptions;
224
}
225
```
226
227
**Generation Process:**
228
1. Base JSON files define configurations
229
2. Template system creates package structure
230
3. Package.json generated with appropriate metadata
231
4. README.md created with usage instructions
232
5. Automated deployment via GitHub Actions
233
234
### Installation and Usage Patterns
235
236
Each base configuration is published as a separate npm package following consistent patterns.
237
238
```bash { .api }
239
# Install specific base
240
npm install --save-dev @tsconfig/node18
241
yarn add --dev @tsconfig/node18
242
243
# Install multiple bases
244
npm install --save-dev @tsconfig/strictest @tsconfig/node18
245
```
246
247
```json { .api }
248
{
249
"extends": "@tsconfig/node18/tsconfig.json",
250
"compilerOptions": {
251
"outDir": "./dist",
252
"rootDir": "./src"
253
},
254
"include": ["src/**/*"],
255
"exclude": ["node_modules", "dist"]
256
}
257
```
258
259
## Complete Base Configuration List
260
261
The ecosystem provides the following pre-configured bases:
262
263
| Base Name | Package | Target Environment |
264
|-----------|---------|-------------------|
265
| Recommended | `@tsconfig/recommended` | General TypeScript best practices |
266
| Strictest | `@tsconfig/strictest` | Maximum type safety |
267
| Bun | `@tsconfig/bun` | Bun runtime |
268
| Create React App | `@tsconfig/create-react-app` | Create React App projects |
269
| Cypress | `@tsconfig/cypress` | Cypress testing framework |
270
| Deno | `@tsconfig/deno` | Deno runtime |
271
| Docusaurus | `@tsconfig/docusaurus` | Docusaurus documentation |
272
| Ember | `@tsconfig/ember` | Ember.js applications |
273
| Next.js | `@tsconfig/next` | Next.js applications |
274
| Node LTS | `@tsconfig/node-lts` | Latest Node.js LTS |
275
| Node 10-21 | `@tsconfig/node10` - `@tsconfig/node21` | Specific Node.js versions |
276
| Nuxt | `@tsconfig/nuxt` | Nuxt.js applications |
277
| React Native | `@tsconfig/react-native` | React Native development |
278
| Remix | `@tsconfig/remix` | Remix applications |
279
| Svelte | `@tsconfig/svelte` | Svelte applications |
280
| Taro | `@tsconfig/taro` | Taro framework |
281
| Vite React | `@tsconfig/vite-react` | Vite + React setup |
282
283
## Types
284
285
```typescript { .api }
286
interface TSConfigBase {
287
$schema: "https://json.schemastore.org/tsconfig";
288
display: string;
289
_version?: string;
290
compilerOptions: {
291
target?: "es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "esnext";
292
module?: "none" | "commonjs" | "amd" | "system" | "umd" | "es6" | "es2015" | "es2020" | "es2022" | "esnext" | "node16" | "nodenext";
293
lib?: string[];
294
moduleResolution?: "node" | "classic" | "node16" | "nodenext" | "bundler";
295
strict?: boolean;
296
esModuleInterop?: boolean;
297
skipLibCheck?: boolean;
298
forceConsistentCasingInFileNames?: boolean;
299
allowSyntheticDefaultImports?: boolean;
300
jsx?: "preserve" | "react" | "react-jsx" | "react-jsxdev" | "react-native";
301
[key: string]: any;
302
};
303
}
304
305
interface PackageTemplate {
306
name: string;
307
repository: {
308
type: "git";
309
url: string;
310
directory: string;
311
};
312
license: "MIT";
313
description?: string;
314
keywords?: string[];
315
version?: string;
316
}
317
```