├── .gitattributes ├── .github └── workflows │ ├── CI.yml │ └── deploy.yml ├── .gitignore ├── .vscode ├── extensions.json └── settings.json ├── LICENSE.md ├── README.md ├── bases ├── bun.json ├── create-react-app.json ├── cypress.json ├── deno.json ├── docusaurus.json ├── ember.json ├── next.json ├── node-lts.json ├── node-ts.json ├── node10.json ├── node12.json ├── node14.json ├── node16.json ├── node17.json ├── node18.json ├── node19.json ├── node20.json ├── node21.json ├── node22.json ├── node23.json ├── node24.json ├── nuxt.json ├── qjsengine.json ├── react-native.json ├── recommended.json ├── remix.json ├── strictest.json ├── svelte.json ├── taro.json └── vite-react.json ├── readme-extras ├── docusaurus.md ├── ember.md ├── node-ts.md ├── nuxt.md ├── remix.md └── svelte.md ├── scripts ├── create-npm-packages.ts ├── deploy-changed-npm-packages.ts ├── generate-lts.ts ├── generate-recommend.ts └── update-markdown-readme.ts └── template ├── LICENSE ├── README.md └── package.json /.gitattributes: -------------------------------------------------------------------------------- 1 | # Treat all bases as 2 | bases/*.json linguist-language=JSON-with-Comments 3 | -------------------------------------------------------------------------------- /.github/workflows/CI.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | # For testing 4 | on: pull_request 5 | 6 | jobs: 7 | ci: 8 | runs-on: ubuntu-latest 9 | 10 | steps: 11 | - name: Checkout tree 12 | uses: actions/checkout@v3 13 | 14 | - name: Set-up Deno 15 | uses: denoland/setup-deno@v1 16 | with: 17 | deno-version: v1.x 18 | 19 | # Build all the packages 20 | - name: Create packages for TSConfig JSONs 21 | run: deno run --allow-read --allow-write --allow-net scripts/create-npm-packages.ts 22 | 23 | - name: Update the README 24 | run: deno run --allow-read --allow-write --allow-net scripts/update-markdown-readme.ts 25 | 26 | - name: Fail if the README needs updating 27 | run: | 28 | if [[ -z $(git status -s) ]] 29 | then 30 | echo "" 31 | else 32 | echo "Please update the README via: deno run --allow-read --allow-write scripts/update-markdown-readme.ts" 33 | exit 1 34 | fi 35 | -------------------------------------------------------------------------------- /.github/workflows/deploy.yml: -------------------------------------------------------------------------------- 1 | name: Daily builds of changes to the TSConfig bases dir 2 | 3 | # For testing 4 | # on: push 5 | 6 | # For production 7 | on: 8 | schedule: 9 | - cron: 0 4 * * * 10 | workflow_dispatch: 11 | 12 | permissions: 13 | id-token: write 14 | 15 | jobs: 16 | deploy: 17 | runs-on: ubuntu-latest 18 | 19 | steps: 20 | - name: Checkout tree 21 | uses: actions/checkout@v3 22 | 23 | - name: Set-up Node.js 24 | uses: actions/setup-node@v3 25 | with: 26 | node-version: lts/* 27 | registry-url: https://registry.npmjs.org 28 | 29 | - name: Set-up Deno 30 | uses: denoland/setup-deno@v1 31 | with: 32 | deno-version: v1.x 33 | 34 | # Build all the packages 35 | - name: Create packages for TSConfig JSONs 36 | run: deno run --allow-read --allow-write --allow-net scripts/create-npm-packages.ts 37 | 38 | # Deploy anything which differs from the npm version of a tsconfig 39 | - name: "Deploy built packages to NPM" 40 | run: | 41 | deno run --allow-read --allow-run --allow-env --allow-net scripts/deploy-changed-npm-packages.ts 42 | env: 43 | NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} 44 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | packages/ 3 | .idea/ 4 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["denoland.vscode-deno"] 3 | } 4 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cSpell.words": ["Deno"], 3 | "deno.enable": true, 4 | "[typescript]": { 5 | "editor.defaultFormatter": "denoland.vscode-deno" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Centralized Recommendations for TSConfig bases 2 | 3 | Hosts TSConfigs for you to extend in your apps, tuned to a particular runtime environment. Owned and improved by the community. 4 | Basically Definitely Typed for TSConfigs. 5 | 6 | We target the latest stable version of TypeScript, note that because we want to be consistent with the versioning the target runtime we can't always do semver releases. 7 | 8 | ### Table of TSConfigs 9 | 10 | | Name | Package | 11 | | -------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | 12 | | [Recommended](#recommended-tsconfigjson) | [`@tsconfig/recommended`](https://npmjs.com/package/@tsconfig/recommended) | 13 | | [Bun](#bun-tsconfigjson) | [`@tsconfig/bun`](https://npmjs.com/package/@tsconfig/bun) | 14 | | [Create React App](#create-react-app-tsconfigjson) | [`@tsconfig/create-react-app`](https://npmjs.com/package/@tsconfig/create-react-app) | 15 | | [Cypress](#cypress-tsconfigjson) | [`@tsconfig/cypress`](https://npmjs.com/package/@tsconfig/cypress) | 16 | | [Deno](#deno-tsconfigjson) | [`@tsconfig/deno`](https://npmjs.com/package/@tsconfig/deno) | 17 | | [Docusaurus v2](#docusaurus-v2-tsconfigjson) | [`@tsconfig/docusaurus`](https://npmjs.com/package/@tsconfig/docusaurus) | 18 | | [Ember](#ember-tsconfigjson) | [`@tsconfig/ember`](https://npmjs.com/package/@tsconfig/ember) | 19 | | [Next.js](#nextjs-tsconfigjson) | [`@tsconfig/next`](https://npmjs.com/package/@tsconfig/next) | 20 | | [Node LTS](#node-lts-22-tsconfigjson) | [`@tsconfig/node-lts`](https://npmjs.com/package/@tsconfig/node-lts) | 21 | | [Node 10](#node-10-tsconfigjson) | [`@tsconfig/node10`](https://npmjs.com/package/@tsconfig/node10) | 22 | | [Node 12](#node-12-tsconfigjson) | [`@tsconfig/node12`](https://npmjs.com/package/@tsconfig/node12) | 23 | | [Node 14](#node-14-tsconfigjson) | [`@tsconfig/node14`](https://npmjs.com/package/@tsconfig/node14) | 24 | | [Node 16](#node-16-tsconfigjson) | [`@tsconfig/node16`](https://npmjs.com/package/@tsconfig/node16) | 25 | | [Node 17](#node-17-tsconfigjson) | [`@tsconfig/node17`](https://npmjs.com/package/@tsconfig/node17) | 26 | | [Node 18](#node-18-tsconfigjson) | [`@tsconfig/node18`](https://npmjs.com/package/@tsconfig/node18) | 27 | | [Node 19](#node-19-tsconfigjson) | [`@tsconfig/node19`](https://npmjs.com/package/@tsconfig/node19) | 28 | | [Node 20](#node-20-tsconfigjson) | [`@tsconfig/node20`](https://npmjs.com/package/@tsconfig/node20) | 29 | | [Node 21](#node-21-tsconfigjson) | [`@tsconfig/node21`](https://npmjs.com/package/@tsconfig/node21) | 30 | | [Node 22](#node-22-tsconfigjson) | [`@tsconfig/node22`](https://npmjs.com/package/@tsconfig/node22) | 31 | | [Node 23](#node-23-tsconfigjson) | [`@tsconfig/node23`](https://npmjs.com/package/@tsconfig/node23) | 32 | | [Node 24](#node-24-tsconfigjson) | [`@tsconfig/node24`](https://npmjs.com/package/@tsconfig/node24) | 33 | | [Node with TypeScript](#node-with-typescript-ts-58-only-tsconfigjson)| [`@tsconfig/node-ts`](https://npmjs.com/package/@tsconfig/node-ts) | 34 | | [Nuxt](#nuxt-tsconfigjson) | [`@tsconfig/nuxt`](https://npmjs.com/package/@tsconfig/nuxt) | 35 | | [QJSEngine](#qjsengine-tsconfigjson) | [`@tsconfig/qjsengine`](https://npmjs.com/package/@tsconfig/qtsengine) | 36 | | [React Native](#react-native-tsconfigjson) | [`@tsconfig/react-native`](https://npmjs.com/package/@tsconfig/react-native) | 37 | | [Remix](#remix-tsconfigjson) | [`@tsconfig/remix`](https://npmjs.com/package/@tsconfig/remix) | 38 | | [Strictest](#strictest-tsconfigjson) | [`@tsconfig/strictest`](https://npmjs.com/package/@tsconfig/strictest) | 39 | | [Svelte](#svelte-tsconfigjson) | [`@tsconfig/svelte`](https://npmjs.com/package/@tsconfig/svelte) | 40 | | [Taro](#taro-tsconfigjson) | [`@tsconfig/taro`](https://npmjs.com/package/@tsconfig/taro) | 41 | | [Vite React](#vite-react-tsconfigjson) | [`@tsconfig/vite-react`](https://npmjs.com/package/@tsconfig/vite-react) | 42 | 43 | 44 | ### Available TSConfigs 45 | 46 | <!-- AUTO --> 47 | ### Recommended <kbd><a href="./bases/recommended.json">tsconfig.json</a></kbd> 48 | 49 | Install: 50 | 51 | ```sh 52 | npm install --save-dev @tsconfig/recommended 53 | yarn add --dev @tsconfig/recommended 54 | ``` 55 | 56 | Add to your `tsconfig.json`: 57 | 58 | ```json 59 | "extends": "@tsconfig/recommended/tsconfig.json" 60 | ``` 61 | 62 | ### Bun <kbd><a href="./bases/bun.json">tsconfig.json</a></kbd> 63 | 64 | Install: 65 | 66 | ```sh 67 | npm install --save-dev @tsconfig/bun 68 | yarn add --dev @tsconfig/bun 69 | ``` 70 | 71 | Add to your `tsconfig.json`: 72 | 73 | ```json 74 | "extends": "@tsconfig/bun/tsconfig.json" 75 | ``` 76 | 77 | ### Create React App <kbd><a href="./bases/create-react-app.json">tsconfig.json</a></kbd> 78 | 79 | Install: 80 | 81 | ```sh 82 | npm install --save-dev @tsconfig/create-react-app 83 | yarn add --dev @tsconfig/create-react-app 84 | ``` 85 | 86 | Add to your `tsconfig.json`: 87 | 88 | ```json 89 | "extends": "@tsconfig/create-react-app/tsconfig.json" 90 | ``` 91 | 92 | ### Cypress <kbd><a href="./bases/cypress.json">tsconfig.json</a></kbd> 93 | 94 | Install: 95 | 96 | ```sh 97 | npm install --save-dev @tsconfig/cypress 98 | yarn add --dev @tsconfig/cypress 99 | ``` 100 | 101 | Add to your `tsconfig.json`: 102 | 103 | ```json 104 | "extends": "@tsconfig/cypress/tsconfig.json" 105 | ``` 106 | 107 | ### Deno <kbd><a href="./bases/deno.json">tsconfig.json</a></kbd> 108 | 109 | Install: 110 | 111 | ```sh 112 | npm install --save-dev @tsconfig/deno 113 | yarn add --dev @tsconfig/deno 114 | ``` 115 | 116 | Add to your `tsconfig.json`: 117 | 118 | ```json 119 | "extends": "@tsconfig/deno/tsconfig.json" 120 | ``` 121 | 122 | ### Docusaurus v2 <kbd><a href="./bases/docusaurus.json">tsconfig.json</a></kbd> 123 | 124 | Install: 125 | 126 | ```sh 127 | npm install --save-dev @tsconfig/docusaurus 128 | yarn add --dev @tsconfig/docusaurus 129 | ``` 130 | 131 | Add to your `tsconfig.json`: 132 | 133 | ```json 134 | "extends": "@tsconfig/docusaurus/tsconfig.json" 135 | ``` 136 | 137 | 138 | 139 | > **NOTE**: You may need to add `"baseUrl": "."` to your `tsconfig.json` to support proper file resolution. 140 | 141 | ### Ember <kbd><a href="./bases/ember.json">tsconfig.json</a></kbd> 142 | 143 | Install: 144 | 145 | ```sh 146 | npm install --save-dev @tsconfig/ember 147 | yarn add --dev @tsconfig/ember 148 | ``` 149 | 150 | Add to your `tsconfig.json`: 151 | 152 | ```json 153 | "extends": "@tsconfig/ember/tsconfig.json" 154 | ``` 155 | 156 | 157 | 158 | > **NOTE**: You may need to add `"baseUrl": "."` to your `tsconfig.json` to support proper file resolution. 159 | 160 | ### Next.js <kbd><a href="./bases/next.json">tsconfig.json</a></kbd> 161 | 162 | Install: 163 | 164 | ```sh 165 | npm install --save-dev @tsconfig/next 166 | yarn add --dev @tsconfig/next 167 | ``` 168 | 169 | Add to your `tsconfig.json`: 170 | 171 | ```json 172 | "extends": "@tsconfig/next/tsconfig.json" 173 | ``` 174 | 175 | ### Node LTS (22) <kbd><a href="./bases/node-lts.json">tsconfig.json</a></kbd> 176 | 177 | Install: 178 | 179 | ```sh 180 | npm install --save-dev @tsconfig/node-lts 181 | yarn add --dev @tsconfig/node-lts 182 | ``` 183 | 184 | Add to your `tsconfig.json`: 185 | 186 | ```json 187 | "extends": "@tsconfig/node-lts/tsconfig.json" 188 | ``` 189 | 190 | ### Node with TypeScript (TS >=5.8 ONLY) <kbd><a href="./bases/node-ts.json">tsconfig.json</a></kbd> 191 | 192 | Install: 193 | 194 | ```sh 195 | npm install --save-dev @tsconfig/node-ts 196 | yarn add --dev @tsconfig/node-ts 197 | ``` 198 | 199 | 200 | > This base require TypeScript 5.8+ (See [announcement](https://devblogs.microsoft.com/typescript/announcing-typescript-5-8-beta/#the---erasablesyntaxonly-option)) 201 | 202 | This file is meant to be used in conjunction with other Node.js configurations, you can do so by extending multiple files in the `extends` clause of your `tsconfig.json`: 203 | 204 | ```json 205 | { 206 | "extends": ["@tsconfig/node22/tsconfig.json", "@tsconfig/node-ts/tsconfig.json"] 207 | } 208 | ``` 209 | 210 | ### Node 10 <kbd><a href="./bases/node10.json">tsconfig.json</a></kbd> 211 | 212 | Install: 213 | 214 | ```sh 215 | npm install --save-dev @tsconfig/node10 216 | yarn add --dev @tsconfig/node10 217 | ``` 218 | 219 | Add to your `tsconfig.json`: 220 | 221 | ```json 222 | "extends": "@tsconfig/node10/tsconfig.json" 223 | ``` 224 | 225 | ### Node 12 <kbd><a href="./bases/node12.json">tsconfig.json</a></kbd> 226 | 227 | Install: 228 | 229 | ```sh 230 | npm install --save-dev @tsconfig/node12 231 | yarn add --dev @tsconfig/node12 232 | ``` 233 | 234 | Add to your `tsconfig.json`: 235 | 236 | ```json 237 | "extends": "@tsconfig/node12/tsconfig.json" 238 | ``` 239 | 240 | ### Node 14 <kbd><a href="./bases/node14.json">tsconfig.json</a></kbd> 241 | 242 | Install: 243 | 244 | ```sh 245 | npm install --save-dev @tsconfig/node14 246 | yarn add --dev @tsconfig/node14 247 | ``` 248 | 249 | Add to your `tsconfig.json`: 250 | 251 | ```json 252 | "extends": "@tsconfig/node14/tsconfig.json" 253 | ``` 254 | 255 | ### Node 16 <kbd><a href="./bases/node16.json">tsconfig.json</a></kbd> 256 | 257 | Install: 258 | 259 | ```sh 260 | npm install --save-dev @tsconfig/node16 261 | yarn add --dev @tsconfig/node16 262 | ``` 263 | 264 | Add to your `tsconfig.json`: 265 | 266 | ```json 267 | "extends": "@tsconfig/node16/tsconfig.json" 268 | ``` 269 | 270 | ### Node 17 <kbd><a href="./bases/node17.json">tsconfig.json</a></kbd> 271 | 272 | Install: 273 | 274 | ```sh 275 | npm install --save-dev @tsconfig/node17 276 | yarn add --dev @tsconfig/node17 277 | ``` 278 | 279 | Add to your `tsconfig.json`: 280 | 281 | ```json 282 | "extends": "@tsconfig/node17/tsconfig.json" 283 | ``` 284 | 285 | ### Node 18 <kbd><a href="./bases/node18.json">tsconfig.json</a></kbd> 286 | 287 | Install: 288 | 289 | ```sh 290 | npm install --save-dev @tsconfig/node18 291 | yarn add --dev @tsconfig/node18 292 | ``` 293 | 294 | Add to your `tsconfig.json`: 295 | 296 | ```json 297 | "extends": "@tsconfig/node18/tsconfig.json" 298 | ``` 299 | 300 | ### Node 19 <kbd><a href="./bases/node19.json">tsconfig.json</a></kbd> 301 | 302 | Install: 303 | 304 | ```sh 305 | npm install --save-dev @tsconfig/node19 306 | yarn add --dev @tsconfig/node19 307 | ``` 308 | 309 | Add to your `tsconfig.json`: 310 | 311 | ```json 312 | "extends": "@tsconfig/node19/tsconfig.json" 313 | ``` 314 | 315 | ### Node 20 <kbd><a href="./bases/node20.json">tsconfig.json</a></kbd> 316 | 317 | Install: 318 | 319 | ```sh 320 | npm install --save-dev @tsconfig/node20 321 | yarn add --dev @tsconfig/node20 322 | ``` 323 | 324 | Add to your `tsconfig.json`: 325 | 326 | ```json 327 | "extends": "@tsconfig/node20/tsconfig.json" 328 | ``` 329 | 330 | ### Node 21 <kbd><a href="./bases/node21.json">tsconfig.json</a></kbd> 331 | 332 | Install: 333 | 334 | ```sh 335 | npm install --save-dev @tsconfig/node21 336 | yarn add --dev @tsconfig/node21 337 | ``` 338 | 339 | Add to your `tsconfig.json`: 340 | 341 | ```json 342 | "extends": "@tsconfig/node21/tsconfig.json" 343 | ``` 344 | 345 | ### Node 22 <kbd><a href="./bases/node22.json">tsconfig.json</a></kbd> 346 | 347 | Install: 348 | 349 | ```sh 350 | npm install --save-dev @tsconfig/node22 351 | yarn add --dev @tsconfig/node22 352 | ``` 353 | 354 | Add to your `tsconfig.json`: 355 | 356 | ```json 357 | "extends": "@tsconfig/node22/tsconfig.json" 358 | ``` 359 | 360 | ### Node 23 <kbd><a href="./bases/node23.json">tsconfig.json</a></kbd> 361 | 362 | Install: 363 | 364 | ```sh 365 | npm install --save-dev @tsconfig/node23 366 | yarn add --dev @tsconfig/node23 367 | ``` 368 | 369 | Add to your `tsconfig.json`: 370 | 371 | ```json 372 | "extends": "@tsconfig/node23/tsconfig.json" 373 | ``` 374 | 375 | ### Node 24 <kbd><a href="./bases/node24.json">tsconfig.json</a></kbd> 376 | 377 | Install: 378 | 379 | ```sh 380 | npm install --save-dev @tsconfig/node24 381 | yarn add --dev @tsconfig/node24 382 | ``` 383 | 384 | Add to your `tsconfig.json`: 385 | 386 | ```json 387 | "extends": "@tsconfig/node24/tsconfig.json" 388 | ``` 389 | 390 | ### Nuxt <kbd><a href="./bases/nuxt.json">tsconfig.json</a></kbd> 391 | 392 | Install: 393 | 394 | ```sh 395 | npm install --save-dev @tsconfig/nuxt 396 | yarn add --dev @tsconfig/nuxt 397 | ``` 398 | 399 | Add to your `tsconfig.json`: 400 | 401 | ```json 402 | "extends": "@tsconfig/nuxt/tsconfig.json" 403 | ``` 404 | 405 | 406 | 407 | > **NOTE**: You may need to add `"baseUrl": "."` to your `tsconfig.json` to support proper file resolution. 408 | 409 | ### QJSEngine <kbd><a href="./bases/qjsengine.json">tsconfig.json</a></kbd> 410 | 411 | Install: 412 | 413 | ```sh 414 | npm install --save-dev @tsconfig/qjsengine 415 | yarn add --dev @tsconfig/qjsengine 416 | ``` 417 | 418 | Add to your `tsconfig.json`: 419 | 420 | ```json 421 | "extends": "@tsconfig/qjsengine/tsconfig.json" 422 | ``` 423 | 424 | ### React Native <kbd><a href="./bases/react-native.json">tsconfig.json</a></kbd> 425 | 426 | Install: 427 | 428 | ```sh 429 | npm install --save-dev @tsconfig/react-native 430 | yarn add --dev @tsconfig/react-native 431 | ``` 432 | 433 | Add to your `tsconfig.json`: 434 | 435 | ```json 436 | "extends": "@tsconfig/react-native/tsconfig.json" 437 | ``` 438 | 439 | ### Remix <kbd><a href="./bases/remix.json">tsconfig.json</a></kbd> 440 | 441 | Install: 442 | 443 | ```sh 444 | npm install --save-dev @tsconfig/remix 445 | yarn add --dev @tsconfig/remix 446 | ``` 447 | 448 | Add to your `tsconfig.json`: 449 | 450 | ```json 451 | "extends": "@tsconfig/remix/tsconfig.json" 452 | ``` 453 | 454 | 455 | 456 | > **NOTE**: You may need to add `"baseUrl": "."` to your `tsconfig.json` to support proper file resolution. 457 | 458 | ### Strictest <kbd><a href="./bases/strictest.json">tsconfig.json</a></kbd> 459 | 460 | Install: 461 | 462 | ```sh 463 | npm install --save-dev @tsconfig/strictest 464 | yarn add --dev @tsconfig/strictest 465 | ``` 466 | 467 | Add to your `tsconfig.json`: 468 | 469 | ```json 470 | "extends": "@tsconfig/strictest/tsconfig.json" 471 | ``` 472 | 473 | ### Svelte <kbd><a href="./bases/svelte.json">tsconfig.json</a></kbd> 474 | 475 | Install: 476 | 477 | ```sh 478 | npm install --save-dev @tsconfig/svelte 479 | yarn add --dev @tsconfig/svelte 480 | ``` 481 | 482 | Add to your `tsconfig.json`: 483 | 484 | ```json 485 | "extends": "@tsconfig/svelte/tsconfig.json" 486 | ``` 487 | 488 | 489 | 490 | > **NOTE**: After `@tsconfig/svelte@2.0.0`, you should add `/// <reference types="svelte" />` to a `d.ts` or a `index.ts`(entry) file to prevent typescript error. 491 | 492 | ### Taro <kbd><a href="./bases/taro.json">tsconfig.json</a></kbd> 493 | 494 | Install: 495 | 496 | ```sh 497 | npm install --save-dev @tsconfig/taro 498 | yarn add --dev @tsconfig/taro 499 | ``` 500 | 501 | Add to your `tsconfig.json`: 502 | 503 | ```json 504 | "extends": "@tsconfig/taro/tsconfig.json" 505 | ``` 506 | 507 | ### Vite React <kbd><a href="./bases/vite-react.json">tsconfig.json</a></kbd> 508 | 509 | Install: 510 | 511 | ```sh 512 | npm install --save-dev @tsconfig/vite-react 513 | yarn add --dev @tsconfig/vite-react 514 | ``` 515 | 516 | Add to your `tsconfig.json`: 517 | 518 | ```json 519 | "extends": "@tsconfig/vite-react/tsconfig.json" 520 | ``` 521 | 522 | 523 | <!-- /AUTO --> 524 | 525 | ### What about combined configs? 526 | 527 | Because of previous limitations in the config extension system of TypeScript, 528 | this repo used to provide combined configs from a few common bases (like Node + ESM, 529 | Node + Strictest and so on). 530 | 531 | This issue is now moot since TypeScript v5.0.0, which provides the [ability to 532 | extend from multiple configs at once](https://devblogs.microsoft.com/typescript/announcing-typescript-5-0-rc/#supporting-multiple-configuration-files-in-extends). For instance, if you want 533 | to start from a Node 18 + Strictest base config, you can install both 534 | `@tsconfig/node18` and `@tsconfig/strictest` packages and extend those configs like so: 535 | 536 | ```jsonc 537 | // tsconfig.json 538 | { 539 | "extends": ["@tsconfig/strictest/tsconfig", "@tsconfig/node18/tsconfig"] 540 | } 541 | ``` 542 | 543 | You can see the result of the combined configs via `tsc --showConfig`. 544 | 545 | ### What about `@tsconfig/esm`? 546 | 547 | We deprecated it in favour of setting [module/moduleResolution](https://github.com/tsconfig/bases/pull/197) to node/bundler. 548 | 549 | ### Contributing 550 | 551 | ```sh 552 | git clone https://github.com/tsconfig/bases.git tsconfig-bases 553 | cd tsconfig-bases 554 | ``` 555 | 556 | Then edit the tsconfig.json files in [`bases/`](./bases). 557 | 558 | Every morning there is a GitHub Action which deploys any changed bases. 559 | 560 | To generate the recommended TSConfig which is generated via `tsc --init`, run: 561 | 562 | ```sh 563 | deno run --allow-read --allow-run --allow-env --allow-write --allow-net scripts/generate-recommend.ts 564 | ``` 565 | 566 | ### Developing 567 | 568 | Create a set of npm packages via: 569 | 570 | ```sh 571 | deno run --allow-read --allow-write --allow-net scripts/create-npm-packages.ts 572 | ``` 573 | 574 | You can inspect them in the `packages/` folder, then they are deployed by passing in the paths to the base files via stdin: 575 | 576 | ```sh 577 | deno run --allow-read --allow-run --allow-env --allow-net scripts/deploy-changed-npm-packages.ts 578 | ``` 579 | 580 | The rest of the files in this repo are for deploying, which uses [Deno](https://deno.land) 1.0. 581 | 582 | If you add a new json file, please run `deno run --allow-read --allow-write scripts/update-markdown-readme.ts` to update the README. 583 | -------------------------------------------------------------------------------- /bases/bun.json: -------------------------------------------------------------------------------- 1 | { 2 | // This is based on https://bun.sh/docs/typescript#suggested-compileroptions 3 | "$schema": "https://json.schemastore.org/tsconfig", 4 | "display": "Bun", 5 | "docs": "https://bun.sh/docs/typescript", 6 | 7 | "compilerOptions": { 8 | // Environment setup & latest features 9 | "lib": ["ESNext"], 10 | "target": "ESNext", 11 | "module": "Preserve", 12 | "moduleDetection": "force", 13 | "jsx": "react-jsx", 14 | "allowJs": true, 15 | 16 | // Bundler mode 17 | "moduleResolution": "bundler", 18 | "allowImportingTsExtensions": true, 19 | "verbatimModuleSyntax": true, 20 | "noEmit": true, 21 | 22 | // Best practices 23 | "strict": true, 24 | "skipLibCheck": true, 25 | "noFallthroughCasesInSwitch": true, 26 | "noUncheckedIndexedAccess": true, 27 | "noImplicitOverride": true, 28 | 29 | // Some stricter flags (disabled by default) 30 | "noUnusedLocals": false, 31 | "noUnusedParameters": false, 32 | "noPropertyAccessFromIndexSignature": false 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /bases/create-react-app.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Create React App", 4 | "_version": "2.0.0", 5 | 6 | "compilerOptions": { 7 | "lib": ["dom", "dom.iterable", "esnext"], 8 | "module": "esnext", 9 | "moduleResolution": "bundler", 10 | "target": "es2015", 11 | 12 | "allowJs": true, 13 | "allowSyntheticDefaultImports": true, 14 | "esModuleInterop": true, 15 | "isolatedModules": true, 16 | "jsx": "react-jsx", 17 | "noEmit": true, 18 | "noFallthroughCasesInSwitch": true, 19 | "resolveJsonModule": true, 20 | "skipLibCheck": true, 21 | "strict": true 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /bases/cypress.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Cypress", 4 | "compilerOptions": { 5 | "target": "es5", 6 | "lib": ["es5", "dom"], 7 | "types": ["cypress"] 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /bases/deno.json: -------------------------------------------------------------------------------- 1 | { 2 | // This is based on https://deno.land/manual/getting_started/typescript#custom-typescript-compiler-options 3 | // then the defaults are removed. 4 | 5 | "$schema": "https://json.schemastore.org/tsconfig", 6 | "display": "Deno", 7 | 8 | "compilerOptions": { 9 | "jsx": "react", 10 | "lib": [], 11 | "resolveJsonModule": true, 12 | "strict": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /bases/docusaurus.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Docusaurus v2", 4 | "docs": "https://v2.docusaurus.io/docs/typescript-support", 5 | "_version": "2.0.0", 6 | 7 | "compilerOptions": { 8 | "allowJs": true, 9 | "esModuleInterop": true, 10 | "jsx": "react", 11 | "lib": ["dom"], 12 | "module": "esnext", 13 | "moduleResolution": "bundler", 14 | "noEmit": true, 15 | "types": ["node", "@docusaurus/module-type-aliases", "@docusaurus/theme-classic"], 16 | "baseUrl": ".", 17 | "paths": { 18 | "@site/*": ["./*"] 19 | }, 20 | "skipLibCheck": true 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /bases/ember.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Ember", 4 | "docs": "https://guides.emberjs.com/release/typescript/", 5 | "_version": "3.0.0", 6 | 7 | // This is the base config used by Ember apps and addons. When actually used 8 | // via Ember CLI (e.g. ember-cli-typescript's blueprint), it additionally has 9 | // `compilerOptions.baseUrl`, `compilerOptions.paths`, and `include` set. 10 | "compilerOptions": { 11 | "target": "es2023", 12 | "module": "esnext", 13 | "moduleResolution": "bundler", 14 | 15 | // We don't want to include types dependencies in our compiled output, so tell TypeScript 16 | // to enforce using `import type` instead of `import` for Types. 17 | "verbatimModuleSyntax": true, 18 | 19 | // Trying to check Ember apps and addons with `allowJs: true` is a recipe 20 | // for many unresolveable type errors, because with *considerable* extra 21 | // configuration it ends up including many files which are *not* valid and 22 | // cannot be: they *appear* to be resolve-able to TS, but are in fact not in 23 | // valid Node-resolveable locations and may not have TS-ready types. This 24 | // will likely improve over time 25 | "allowJs": false, 26 | 27 | // Practically, it is *nearly* impossible to have every type-checked 28 | // package in your dependency graph to have compatible types. 29 | // Good stewards of the ecosystem may opt to set this to false and try to 30 | // fix packages with failures, but for most people, the error information 31 | // is inactionable noise. 32 | "skipLibCheck": true, 33 | 34 | // --- TS for SemVer Types compatibility 35 | // Strictness settings -- you should *not* change these: Ember code is not 36 | // guaranteed to type check with these set to looser values. 37 | "strict": true, 38 | "noUncheckedIndexedAccess": true, 39 | 40 | // Interop: this is viral and will require anyone downstream of your package 41 | // to *also* set them to true. However, this represents the way that 42 | // bundlers actually work, and is future-compatible with the closest module 43 | // modes: "nodenext" in TS 4.7+ and "mixed" in 5.0+ mode. Since Ember apps 44 | // and addons never emit with `tsc`, this is safe: it makes type-checking do 45 | // the right thing, but does not result in changes to what gets emitted. We 46 | // intentionally leave `esModuleInterop` unset, so that it gets whatever TS 47 | // provides as the default for the currently-specified `module` mode. 48 | "allowSyntheticDefaultImports": true, 49 | 50 | // --- Lint-style rules 51 | 52 | // TypeScript also supplies some lint-style checks; nearly all of them are 53 | // better handled by ESLint with the `@typescript-eslint`. This one is more 54 | // like a safety check, though, so we leave it on. 55 | "noPropertyAccessFromIndexSignature": true, 56 | 57 | // --- Compilation/integration settings 58 | // Setting `noEmitOnError` here allows tools trying to respect the tsconfig 59 | // to still emit code without breaking on errors. 60 | // Errors are still reported in the CLI when running `tsc` or `glint`, 61 | // but the errors won't prevent code from being emitted. 62 | // This helps hasten development by allowing devs to prototype before coming 63 | // to a decision on what they want their types to be. 64 | "noEmitOnError": false, 65 | 66 | // We use Babel for emitting runtime code, because it's very important that 67 | // we always and only use the same transpiler for non-stable features, in 68 | // particular decorators. If you were to change this to `true`, it could 69 | // lead to accidentally generating code with `tsc` instead of Babel, and 70 | // could thereby result in broken code at runtime. 71 | "noEmit": true, 72 | 73 | // Ember makes heavy use of decorators; TS does not support them at all 74 | // without this flag. 75 | "experimentalDecorators": true, 76 | 77 | // We don't use TS for compilation, so we can disable these. 78 | // Library authors should set declaration and declarationMap to true, however 79 | "declaration": false, 80 | "declarationMap": false, 81 | "inlineSourceMap": false, 82 | "inlineSources": false, 83 | 84 | // Don't implicitly pull in declarations from `@types` packages unless we 85 | // actually import from them AND the package in question doesn't bring its 86 | // own types. 87 | // 88 | // You may wish to override this e.g. with `"types": ["ember-source/types"]` 89 | "types": [] 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /bases/next.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Next.js", 4 | "_version": "2.0.0", 5 | 6 | "compilerOptions": { 7 | "lib": ["dom", "dom.iterable", "esnext"], 8 | "allowJs": true, 9 | "skipLibCheck": true, 10 | "strict": true, 11 | "noEmit": true, 12 | "esModuleInterop": true, 13 | "module": "esnext", 14 | "moduleResolution": "bundler", 15 | "resolveJsonModule": true, 16 | "isolatedModules": true, 17 | "jsx": "preserve", 18 | "incremental": true, 19 | "plugins": [ 20 | { 21 | "name": "next" 22 | } 23 | ] 24 | }, 25 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 26 | "exclude": ["node_modules"] 27 | } 28 | -------------------------------------------------------------------------------- /bases/node-lts.json: -------------------------------------------------------------------------------- 1 | // This file was autogenerated by a script 2 | // Equivalent to a config of: node22 3 | { 4 | "$schema": "https://json.schemastore.org/tsconfig", 5 | "display": "Node LTS (22)", 6 | "_version": "22.0.0", 7 | "compilerOptions": { 8 | "lib": [ 9 | "es2024", 10 | "ESNext.Array", 11 | "ESNext.Collection", 12 | "ESNext.Iterator" 13 | ], 14 | "module": "nodenext", 15 | "target": "es2022", 16 | "strict": true, 17 | "esModuleInterop": true, 18 | "skipLibCheck": true, 19 | "moduleResolution": "node16" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /bases/node-ts.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Node with TypeScript (TS >=5.8 ONLY)", 4 | "docs": [ 5 | "https://devblogs.microsoft.com/typescript/announcing-typescript-5-7/#path-rewriting-for-relative-paths", 6 | "https://devblogs.microsoft.com/typescript/announcing-typescript-5-8-beta/#the---erasablesyntaxonly-option" 7 | ], 8 | "_version": "23.6.0", 9 | "compilerOptions": { 10 | "rewriteRelativeImportExtensions": true, 11 | "erasableSyntaxOnly": true, 12 | "verbatimModuleSyntax": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /bases/node10.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Node 10", 4 | 5 | "compilerOptions": { 6 | "lib": ["es2018"], 7 | "module": "commonjs", 8 | "target": "es2018", 9 | 10 | "strict": true, 11 | "esModuleInterop": true, 12 | "skipLibCheck": true, 13 | "moduleResolution": "node" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /bases/node12.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Node 12", 4 | "_version": "12.1.0", 5 | 6 | "compilerOptions": { 7 | "lib": ["es2019", "es2020.promise", "es2020.bigint", "es2020.string"], 8 | "module": "node16", 9 | "target": "es2019", 10 | 11 | "strict": true, 12 | "esModuleInterop": true, 13 | "skipLibCheck": true, 14 | "moduleResolution": "node16" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /bases/node14.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Node 14", 4 | "_version": "14.1.0", 5 | 6 | "compilerOptions": { 7 | "lib": ["es2020"], 8 | "module": "node16", 9 | "target": "es2020", 10 | 11 | "strict": true, 12 | "esModuleInterop": true, 13 | "skipLibCheck": true, 14 | "moduleResolution": "node16" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /bases/node16.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Node 16", 4 | "_version": "16.1.0", 5 | 6 | "compilerOptions": { 7 | "lib": ["es2021"], 8 | "module": "node16", 9 | "target": "es2021", 10 | 11 | "strict": true, 12 | "esModuleInterop": true, 13 | "skipLibCheck": true, 14 | "moduleResolution": "node16" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /bases/node17.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Node 17", 4 | "_version": "17.1.0", 5 | "compilerOptions": { 6 | "lib": ["es2022"], 7 | "module": "node16", 8 | "target": "es2022", 9 | 10 | "strict": true, 11 | "esModuleInterop": true, 12 | "skipLibCheck": true, 13 | "useDefineForClassFields": true, 14 | "moduleResolution": "node16" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /bases/node18.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Node 18", 4 | 5 | "_version": "18.2.0", 6 | 7 | "compilerOptions": { 8 | "lib": ["es2023"], 9 | "module": "node16", 10 | "target": "es2022", 11 | 12 | "strict": true, 13 | "esModuleInterop": true, 14 | "skipLibCheck": true, 15 | "moduleResolution": "node16" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /bases/node19.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Node 19", 4 | 5 | "_version": "19.1.0", 6 | 7 | "compilerOptions": { 8 | "lib": ["es2023"], 9 | "module": "node16", 10 | "target": "es2022", 11 | 12 | "strict": true, 13 | "esModuleInterop": true, 14 | "skipLibCheck": true, 15 | "moduleResolution": "node16" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /bases/node20.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Node 20", 4 | "_version": "20.1.0", 5 | 6 | "compilerOptions": { 7 | "lib": ["es2023"], 8 | "module": "nodenext", 9 | "target": "es2022", 10 | 11 | "strict": true, 12 | "esModuleInterop": true, 13 | "skipLibCheck": true, 14 | "moduleResolution": "node16" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /bases/node21.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Node 21", 4 | "_version": "21.0.0", 5 | 6 | "compilerOptions": { 7 | "lib": ["es2023"], 8 | "module": "nodenext", 9 | "target": "es2022", 10 | 11 | "strict": true, 12 | "esModuleInterop": true, 13 | "skipLibCheck": true, 14 | "moduleResolution": "node16" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /bases/node22.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Node 22", 4 | "_version": "22.0.0", 5 | 6 | "compilerOptions": { 7 | "lib": ["es2024", "ESNext.Array", "ESNext.Collection", "ESNext.Iterator"], 8 | "module": "nodenext", 9 | "target": "es2022", 10 | 11 | "strict": true, 12 | "esModuleInterop": true, 13 | "skipLibCheck": true, 14 | "moduleResolution": "node16" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /bases/node23.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Node 23", 4 | "_version": "23.0.0", 5 | 6 | "compilerOptions": { 7 | "lib": ["es2024", "ESNext.Array", "ESNext.Collection", "ESNext.Iterator", "ESNext.Promise"], 8 | "module": "nodenext", 9 | "target": "es2024", 10 | 11 | "strict": true, 12 | "esModuleInterop": true, 13 | "skipLibCheck": true, 14 | "moduleResolution": "node16" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /bases/node24.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Node 24", 4 | "_version": "24.0.0", 5 | 6 | "compilerOptions": { 7 | "lib": [ 8 | "es2024", 9 | "ESNext.Array", 10 | "ESNext.Collection", 11 | "ESNext.Iterator", 12 | "ESNext.Promise" 13 | ], 14 | "module": "nodenext", 15 | "target": "es2024", 16 | 17 | "strict": true, 18 | "esModuleInterop": true, 19 | "skipLibCheck": true, 20 | "moduleResolution": "node16" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /bases/nuxt.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Nuxt", 4 | "_version": "2.0.0", 5 | 6 | "compilerOptions": { 7 | "target": "esnext", 8 | "module": "esnext", 9 | "moduleResolution": "bundler", 10 | "lib": [ 11 | "esnext", 12 | "esnext.asynciterable", 13 | "dom" 14 | ], 15 | "esModuleInterop": true, 16 | "allowJs": true, 17 | "sourceMap": true, 18 | "strict": true, 19 | "noEmit": true, 20 | "baseUrl": ".", 21 | "paths": { 22 | "~/*": [ 23 | "./*" 24 | ], 25 | "@/*": [ 26 | "./*" 27 | ] 28 | }, 29 | "types": [ 30 | "@types/node", 31 | "@nuxt/types" 32 | ] 33 | }, 34 | "exclude": [ 35 | "node_modules", 36 | ".nuxt", 37 | "dist" 38 | ] 39 | } 40 | -------------------------------------------------------------------------------- /bases/qjsengine.json: -------------------------------------------------------------------------------- 1 | { 2 | // https://doc.qt.io/qt-5/qjsengine.html 3 | "$schema": "https://json.schemastore.org/tsconfig", 4 | "display": "QJSEngine", 5 | 6 | "compilerOptions": { 7 | // Technically QTJSEngine supportes ES2016, however there are issues with 8 | // arrow functions where in certain contexts "this" does not exist. 9 | // Targeting ES5 instead fixes these issues by binding this to a variable 10 | // and closing over that instead. 11 | "target": "ES5", 12 | "lib": ["ES2016"], 13 | "module": "none", 14 | "esModuleInterop": false, 15 | "strict": true 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /bases/react-native.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "React Native", 4 | "_version": "3.0.2", 5 | "compilerOptions": { 6 | "target": "esnext", 7 | "module": "commonjs", 8 | "types": ["react-native", "jest"], 9 | "lib": [ 10 | "es2019", 11 | "es2020.bigint", 12 | "es2020.date", 13 | "es2020.number", 14 | "es2020.promise", 15 | "es2020.string", 16 | "es2020.symbol.wellknown", 17 | "es2021.promise", 18 | "es2021.string", 19 | "es2021.weakref", 20 | "es2022.array", 21 | "es2022.object", 22 | "es2022.string" 23 | ], 24 | "allowJs": true, 25 | "jsx": "react-native", 26 | "noEmit": true, 27 | "isolatedModules": true, 28 | "strict": true, 29 | "moduleResolution": "node", 30 | "resolveJsonModule": true, 31 | "allowSyntheticDefaultImports": true, 32 | "esModuleInterop": true, 33 | "skipLibCheck": true 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /bases/recommended.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2016", 4 | "module": "commonjs", 5 | "esModuleInterop": true, 6 | "forceConsistentCasingInFileNames": true, 7 | "strict": true, 8 | "skipLibCheck": true 9 | }, 10 | "display": "Recommended", 11 | "$schema": "https://json.schemastore.org/tsconfig" 12 | } -------------------------------------------------------------------------------- /bases/remix.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Remix", 4 | "_version": "2.0.0", 5 | 6 | "compilerOptions": { 7 | "lib": ["dom", "dom.iterable", "es2019"], 8 | "isolatedModules": true, 9 | "esModuleInterop": true, 10 | "jsx": "react-jsx", 11 | "module": "esnext", 12 | "moduleResolution": "bundler", 13 | "resolveJsonModule": true, 14 | "target": "es2019", 15 | "strict": true, 16 | "allowJs": true, 17 | "baseUrl": ".", 18 | "paths": { 19 | "~/*": ["./app/*"] 20 | }, 21 | 22 | // Remix takes care of building everything in `remix build`. 23 | "noEmit": true 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /bases/strictest.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "strict": true, 4 | "allowUnusedLabels": false, 5 | "allowUnreachableCode": false, 6 | "exactOptionalPropertyTypes": true, 7 | "noFallthroughCasesInSwitch": true, 8 | "noImplicitOverride": true, 9 | "noImplicitReturns": true, 10 | "noPropertyAccessFromIndexSignature": true, 11 | "noUncheckedIndexedAccess": true, 12 | "noUnusedLocals": true, 13 | "noUnusedParameters": true, 14 | 15 | "isolatedModules": true, 16 | 17 | "checkJs": true, 18 | 19 | "esModuleInterop": true, 20 | "skipLibCheck": true 21 | }, 22 | "$schema": "https://json.schemastore.org/tsconfig", 23 | "display": "Strictest", 24 | "_version": "2.0.0" 25 | } 26 | -------------------------------------------------------------------------------- /bases/svelte.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Svelte", 4 | "_version": "5.0.0", 5 | 6 | "compilerOptions": { 7 | "module": "esnext", 8 | "moduleResolution": "bundler", 9 | "target": "es2017", 10 | /** 11 | Svelte Preprocess cannot figure out whether you have a value or a type, so tell TypeScript 12 | to enforce using `import type` instead of `import` for Types. 13 | */ 14 | "verbatimModuleSyntax": true, 15 | /** 16 | To have warnings/errors of the Svelte compiler at the correct position, 17 | enable source maps by default. 18 | */ 19 | "sourceMap": true, 20 | 21 | "strict": true, 22 | "esModuleInterop": true, 23 | "skipLibCheck": true 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /bases/taro.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Taro", 4 | "compileOnSave": false, 5 | "compilerOptions": { 6 | "target": "es2017", 7 | "module": "commonjs", 8 | "moduleResolution": "node", 9 | "allowJs": true, 10 | "allowSyntheticDefaultImports": true, 11 | "experimentalDecorators": true, 12 | "resolveJsonModule": true, 13 | "skipLibCheck": true, 14 | "strict": true, 15 | "noEmit": true, 16 | "jsx": "react-jsx" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /bases/vite-react.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Vite React", 4 | "_version": "7.0.0", 5 | 6 | "compilerOptions": { 7 | "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", 8 | "target": "ES2022", 9 | "useDefineForClassFields": true, 10 | "lib": ["ES2022", "DOM", "DOM.Iterable"], 11 | "module": "ESNext", 12 | "skipLibCheck": true, 13 | 14 | /* Bundler mode */ 15 | "moduleResolution": "bundler", 16 | "allowImportingTsExtensions": true, 17 | "verbatimModuleSyntax": true, 18 | "moduleDetection": "force", 19 | "noEmit": true, 20 | "jsx": "react-jsx", 21 | 22 | /* Linting */ 23 | "strict": true, 24 | "noUnusedLocals": true, 25 | "noUnusedParameters": true, 26 | "erasableSyntaxOnly": true, 27 | "noFallthroughCasesInSwitch": true, 28 | "noUncheckedSideEffectImports": true 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /readme-extras/docusaurus.md: -------------------------------------------------------------------------------- 1 | > **NOTE**: You may need to add `"baseUrl": "."` to your `tsconfig.json` to support proper file resolution. 2 | -------------------------------------------------------------------------------- /readme-extras/ember.md: -------------------------------------------------------------------------------- 1 | > **NOTE**: You may need to add `"baseUrl": "."` to your `tsconfig.json` to support proper file resolution. 2 | -------------------------------------------------------------------------------- /readme-extras/node-ts.md: -------------------------------------------------------------------------------- 1 | > This base require TypeScript 5.8+ (See [announcement](https://devblogs.microsoft.com/typescript/announcing-typescript-5-8-beta/#the---erasablesyntaxonly-option)) 2 | 3 | This file is meant to be used in conjunction with other Node.js configurations, you can do so by extending multiple files in the `extends` clause of your `tsconfig.json`: 4 | 5 | ```json 6 | { 7 | "extends": ["@tsconfig/node22/tsconfig.json", "@tsconfig/node-ts/tsconfig.json"] 8 | } 9 | ``` 10 | -------------------------------------------------------------------------------- /readme-extras/nuxt.md: -------------------------------------------------------------------------------- 1 | > **NOTE**: You may need to add `"baseUrl": "."` to your `tsconfig.json` to support proper file resolution. 2 | -------------------------------------------------------------------------------- /readme-extras/remix.md: -------------------------------------------------------------------------------- 1 | > **NOTE**: You may need to add `"baseUrl": "."` to your `tsconfig.json` to support proper file resolution. 2 | -------------------------------------------------------------------------------- /readme-extras/svelte.md: -------------------------------------------------------------------------------- 1 | > **NOTE**: After `@tsconfig/svelte@2.0.0`, you should add `/// <reference types="svelte" />` to a `d.ts` or a `index.ts`(entry) file to prevent typescript error. 2 | -------------------------------------------------------------------------------- /scripts/create-npm-packages.ts: -------------------------------------------------------------------------------- 1 | import * as path from "https://deno.land/std/path/mod.ts"; 2 | import stripJsonComments from "https://esm.sh/strip-json-comments"; 3 | 4 | for await (const tsconfigEntry of Deno.readDir("bases")) { 5 | if (!tsconfigEntry.isFile) continue 6 | 7 | const tsconfigFilePath = path.join("bases", tsconfigEntry.name) 8 | const name = path.basename(tsconfigEntry.name).replace(".json", "") 9 | 10 | // Make the folder 11 | const packagePath = path.join("packages", name) 12 | Deno.mkdirSync(packagePath, { recursive: true }) 13 | 14 | // Copy over the template files 15 | const templateDir = "./template" 16 | for await (const templateFile of Deno.readDir(templateDir)) { 17 | if (!templateFile.isFile) continue 18 | const templatedFile = path.join(templateDir, templateFile.name) 19 | Deno.copyFileSync(templatedFile, path.join(packagePath, templateFile.name)) 20 | } 21 | 22 | // Copy the create a tsconfig.json from the base json 23 | const newPackageTSConfigPath = path.join(packagePath, "tsconfig.json") 24 | Deno.copyFileSync(tsconfigFilePath, newPackageTSConfigPath) 25 | 26 | const tsconfigText = await Deno.readTextFile(newPackageTSConfigPath) 27 | const tsconfigJSON = JSON.parse(stripJsonComments(tsconfigText)) 28 | 29 | // Drop `display` field in tsconfig.json for npm package 30 | await Deno.writeTextFile(newPackageTSConfigPath, tsconfigText.replace(/\s*"display.*/,'')) 31 | 32 | // Edit the package.json 33 | const packageText = await Deno.readTextFile(path.join(packagePath, "package.json")) 34 | const packageJSON = JSON.parse(packageText) 35 | packageJSON.name = `@tsconfig/${name}` 36 | packageJSON.description = `A base TSConfig for working with ${tsconfigJSON.display}.` 37 | packageJSON.keywords = ["tsconfig", name] 38 | 39 | // Do some string replacements in the other templated files 40 | const replaceTextIn = ["README.md"] 41 | for (const filenameToEdit of replaceTextIn) { 42 | const fileToEdit = path.join(packagePath, filenameToEdit) 43 | 44 | const defaultTitle = `A base TSConfig for working with ${tsconfigJSON.display}` 45 | const title = name !== "recommended" ? defaultTitle : "The recommended base for a TSConfig" 46 | 47 | let packageText = await Deno.readTextFile(fileToEdit) 48 | packageText = packageText.replace(/\[filename\]/g, name) 49 | .replace(/\[display_title\]/g, title) 50 | .replace(/\[tsconfig\]/g, Deno.readTextFileSync(newPackageTSConfigPath)) 51 | 52 | // Inject readme-extra if any 53 | try { 54 | const readmeExtra = (await Deno.readTextFile(path.join("readme-extras", `${name}.md`))).trim() 55 | 56 | if (readmeExtra) 57 | packageText = packageText.replace(/\[readme-extra\]/g, `\n${readmeExtra}\n`) 58 | } catch (error) { 59 | // NOOP, there is no extra readme 60 | // console.log(error) 61 | } 62 | 63 | // Remove readme-extra placeholders if any 64 | packageText = packageText.replace(/\[readme-extra\]/g, '') 65 | 66 | await Deno.writeTextFile(fileToEdit, packageText) 67 | }; 68 | 69 | // Bump the last version of the number from npm, 70 | // or use the _version in tsconfig if it's higher, 71 | // or default to 1.0.0 72 | let version = tsconfigJSON._version || "1.0.0" 73 | try { 74 | const npmResponse = await fetch(`https://registry.npmjs.org/${packageJSON.name}`) 75 | const npmPackage = await npmResponse.json() 76 | 77 | const semverMarkers = npmPackage["dist-tags"].latest.split("."); 78 | const bumpedVersion = `${semverMarkers[0]}.${semverMarkers[1]}.${Number(semverMarkers[2]) + 1}`; 79 | if (isBumpedVersionHigher(version, bumpedVersion)) { 80 | version = bumpedVersion; 81 | } 82 | } catch (error) { 83 | // NOOP, this is for the first deploy 84 | // console.log(error) 85 | } 86 | 87 | packageJSON.version = version 88 | await Deno.writeTextFile(path.join(packagePath, "package.json"), JSON.stringify(packageJSON, null, " ")) 89 | 90 | console.log("Built:", tsconfigEntry.name); 91 | } 92 | 93 | function isBumpedVersionHigher (packageJSONVersion: string, bumpedVersion: string) { 94 | const semverMarkersPackageJSON = packageJSONVersion.split('.') 95 | const semverMarkersBumped = bumpedVersion.split('.') 96 | for (let i = 0; i < 3; i++) { 97 | if (Number(semverMarkersPackageJSON[i]) > Number(semverMarkersBumped[i])) { 98 | return false 99 | } 100 | } 101 | 102 | return true 103 | } 104 | -------------------------------------------------------------------------------- /scripts/deploy-changed-npm-packages.ts: -------------------------------------------------------------------------------- 1 | import * as path from "https://deno.land/std@0.164.0/path/mod.ts"; 2 | import * as bufio from "https://deno.land/std@0.164.0/io/buffer.ts"; 3 | 4 | // Loop through generated packages, deploying versions for anything which has a different tsconfig 5 | const uploaded = [] 6 | 7 | for (const dirEntry of Deno.readDirSync("packages")) { 8 | const localTsconfigPath = path.join("packages", dirEntry.name, "tsconfig.json"); 9 | const newTSConfig = Deno.readTextFileSync(localTsconfigPath); 10 | 11 | let upload = false; 12 | try { 13 | const unpkgURL = `https://unpkg.com/@tsconfig/${dirEntry.name}/tsconfig.json`; 14 | const currentJSONReq = await fetch(unpkgURL); 15 | const currentJSONTxt = await currentJSONReq.text(); 16 | upload = currentJSONTxt !== newTSConfig; 17 | } catch (error) { 18 | // Not here, definitely needs to be uploaded 19 | upload = true; 20 | } 21 | 22 | if (upload) { 23 | const process = Deno.run({ 24 | cmd: ["npm", "publish", "--provenance", "--access", "public"], 25 | stdout: "piped", 26 | cwd: path.join("packages", dirEntry.name), 27 | env: { NODE_AUTH_TOKEN: Deno.env.get("NODE_AUTH_TOKEN")! }, 28 | }); 29 | 30 | for await (const line of bufio.readLines(process.stdout!)) { 31 | console.warn(line); 32 | } 33 | 34 | uploaded.push(dirEntry.name) 35 | } 36 | } 37 | 38 | if (uploaded.length) { 39 | console.log("Uploaded: ", uploaded.join(", ")) 40 | } else { 41 | console.log("No uploads") 42 | } 43 | -------------------------------------------------------------------------------- /scripts/generate-lts.ts: -------------------------------------------------------------------------------- 1 | // deno run --allow-read --allow-write --allow-net scripts/generate-lts.ts 2 | // 3 | 4 | import { gt } from "https://deno.land/std@0.192.0/semver/gt.ts"; 5 | import { parse } from "https://deno.land/std@0.192.0/semver/parse.ts"; 6 | 7 | interface NodeReleaseMetadata { 8 | version: string; 9 | date: string; 10 | files: string[]; 11 | npm?: string; 12 | v8: string; 13 | uv?: string; 14 | zlib?: string; 15 | openssl?: string; 16 | modules?: string; 17 | lts: string | boolean; 18 | security: boolean; 19 | } 20 | 21 | type Tsconfig = Record<string, any>; 22 | 23 | const versionRegex = /v(\d+)\.(\d+)\.(\d+)/; 24 | 25 | const releasesResponse = await fetch("https://nodejs.org/download/release/index.json"); 26 | const releasesJson = (await releasesResponse.json()) as NodeReleaseMetadata[]; 27 | const lts = releasesJson 28 | .filter((r) => r.lts) 29 | .reduce( 30 | (prevValue, currValue) => (gt(parse(currValue.version), parse(prevValue.version)) ? currValue : prevValue), 31 | { 32 | version: "v0.0.0" 33 | } 34 | ); 35 | const baseMajorVersion = (lts.version.match(versionRegex) || [])[1]; 36 | const base = `node${baseMajorVersion}`; 37 | const versioned = { 38 | $schema: "https://json.schemastore.org/tsconfig", 39 | display: `Node LTS (${baseMajorVersion})`, 40 | _version: lts.version.substring(lts.version.indexOf("v") + 1) 41 | }; 42 | 43 | import * as path from "https://deno.land/std/path/mod.ts"; 44 | import stripJsonComments from "https://esm.sh/strip-json-comments"; 45 | import { deepMerge } from "https://deno.land/std/collections/deep_merge.ts"; 46 | 47 | const packageText = await Deno.readTextFile(path.join(Deno.cwd(), "bases", `${base}.json`)); 48 | 49 | const parsed = JSON.parse(stripJsonComments(packageText)) as Tsconfig; 50 | 51 | // This is to get the _version property to show up directly under the display property 52 | const parsedAndOrdered = deepMerge(versioned, parsed); 53 | parsedAndOrdered.display = versioned.display; 54 | 55 | const serializedConfig = 56 | "// This file was autogenerated by a script\n" + 57 | `// Equivalent to a config of: ${base}\n` + 58 | JSON.stringify(parsedAndOrdered, null, " ") + 59 | "\n"; 60 | 61 | const filePath = path.join(Deno.cwd(), "bases/node-lts.json"); 62 | Deno.writeTextFile(filePath, serializedConfig); 63 | -------------------------------------------------------------------------------- /scripts/generate-recommend.ts: -------------------------------------------------------------------------------- 1 | import stripJsonComments from "https://esm.sh/strip-json-comments"; 2 | import * as bufio from "https://deno.land/std@0.164.0/io/buffer.ts"; 3 | import * as path from "https://deno.land/std/path/mod.ts"; 4 | 5 | const tsconfigStorage = await Deno.makeTempDir({ prefix: "tsconfig" }); 6 | 7 | // Generate a tsconfig 8 | const p = await Deno.run({ cmd: ["npx", "-p", "typescript", "tsc", "--init"], stdout: "piped", cwd: tsconfigStorage }); 9 | for await (const line of bufio.readLines(p.stdout!)) { 10 | console.warn(line); 11 | } 12 | 13 | let packageText = await Deno.readTextFile(path.join(tsconfigStorage, "tsconfig.json")); 14 | // This will strip comments 15 | const parsed = JSON.parse(stripJsonComments(packageText)); 16 | 17 | // `display` field will be dropped at generating npm package, so prevent the order from being last in the JSON file 18 | parsed.display = "Recommended"; 19 | parsed["$schema"] = "https://json.schemastore.org/tsconfig"; 20 | 21 | const result = JSON.stringify(parsed, null, " "); 22 | 23 | const npmResponse = await fetch(`https://unpkg.com/@tsconfig/svelte/tsconfig.json`); 24 | const npmPackage = await npmResponse.text(); 25 | 26 | if (npmPackage !== result) { 27 | Deno.writeTextFile("bases/recommended.json", result); 28 | } 29 | -------------------------------------------------------------------------------- /scripts/update-markdown-readme.ts: -------------------------------------------------------------------------------- 1 | // deno run --allow-read --allow-write scripts/update-markdown-readme.ts 2 | // 3 | import * as path from "https://deno.land/std/path/mod.ts"; 4 | import stripJsonComments from "https://esm.sh/strip-json-comments"; 5 | 6 | const readme = await Deno.readTextFileSync("./README.md") 7 | let center = "" 8 | 9 | const paths = [] 10 | for await (const tsconfigEntry of Deno.readDir("bases")) { 11 | if (!tsconfigEntry.isFile) continue 12 | paths.push(tsconfigEntry.name) 13 | } 14 | 15 | const sortedPaths = paths.sort((l, r) => l.localeCompare(r)).filter(r => !r.includes("recommended")) 16 | const basePaths = ["recommended.json", ...sortedPaths] 17 | for (const base of basePaths) { 18 | if (base === "esm.json") continue 19 | const tsconfigFilePath = path.join("bases", base) 20 | const name = path.basename(base).replace(".json", "") 21 | 22 | const tsconfigText = await Deno.readTextFile(tsconfigFilePath) 23 | const tsconfigJSON = JSON.parse(stripJsonComments(tsconfigText)) 24 | 25 | center += `### ${tsconfigJSON.display} <kbd><a href="./bases/${base}">tsconfig.json</a></kbd>\n` 26 | 27 | center += ` 28 | Install: 29 | 30 | \`\`\`sh 31 | npm install --save-dev @tsconfig/${name} 32 | yarn add --dev @tsconfig/${name} 33 | \`\`\` 34 | 35 | ` 36 | 37 | const hasReadmeExtra = await Deno.stat(`./readme-extras/${name}.md`).then(() => true).catch(() => false) 38 | const readmeExtra = hasReadmeExtra ? (await Deno.readTextFile(`./readme-extras/${name}.md`)).trim() : "" 39 | 40 | const defaultInstructions = `Add to your \`tsconfig.json\`: 41 | 42 | \`\`\`json 43 | "extends": "@tsconfig/${name}/tsconfig.json" 44 | \`\`\` 45 | 46 | ` 47 | 48 | if (readmeExtra) { 49 | if (!readmeExtra.includes("extends")) { 50 | center += defaultInstructions + "\n" 51 | } 52 | 53 | center += `\n${readmeExtra}\n\n` 54 | 55 | } else { 56 | center += defaultInstructions 57 | } 58 | }; 59 | 60 | const startMarker ="<!-- AUTO -->" 61 | const start = readme.split(startMarker)[0] 62 | const endMarker ="<!-- /AUTO -->" 63 | const end = readme.split(endMarker)[1] 64 | const newREADME = start + startMarker + "\n" + center + "\n" + endMarker + end 65 | 66 | await Deno.writeTextFileSync("./README.md", newREADME) 67 | -------------------------------------------------------------------------------- /template/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /template/README.md: -------------------------------------------------------------------------------- 1 | ### [display_title]. 2 | 3 | Add the package to your `"devDependencies"`: 4 | 5 | ```sh 6 | npm install --save-dev @tsconfig/[filename] 7 | yarn add --dev @tsconfig/[filename] 8 | ``` 9 | 10 | Add to your `tsconfig.json`: 11 | 12 | ```json 13 | "extends": "@tsconfig/[filename]/tsconfig.json" 14 | ``` 15 | [readme-extra] 16 | --- 17 | 18 | The `tsconfig.json`: 19 | 20 | ```jsonc 21 | [tsconfig] 22 | ``` 23 | 24 | You can find the [code here](https://github.com/tsconfig/bases/blob/master/bases/[filename].json). 25 | -------------------------------------------------------------------------------- /template/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "replaced-later", 3 | "repository": { 4 | "type": "git", 5 | "url": "https://github.com/tsconfig/bases.git", 6 | "directory": "bases" 7 | }, 8 | "license": "MIT" 9 | } 10 | --------------------------------------------------------------------------------