Ctrl K
ComunidadGuías…

tsconfig.json

Rama beta · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
/*
 * SPDX-FileCopyrightText: 2024-2025 Pagefault Games
 *
 * SPDX-License-Identifier: AGPL-3.0-only
 */
{
  "compilerOptions": {
    "target": "ES2022",
    "module": "ES2022",
    // Modifying this option requires all values to be set manually because the defaults get overridden
    // ES2022 stdlibs taken from https://github.com/microsoft/TypeScript/blob/9eedcb0dd7257f8a1a175adbef28f3b6d3492d7a/tsc/internal/bundled/libs/lib.es2022.full.d.ts
    "lib": [
      // ES2022 stdlibs
      "ES2022",
      "DOM",
      "ScriptHost",
      "WebWorker.ImportScripts",
      // future libs
      "ES2023.Array",
      "ES2024.Promise",
      "ES2024.Object",
      // NOTE: Be *very* mindful of these when updating typescript versions,
      // as their definitions may change in breaking ways
      "ESNext.Iterator",
      "ESNext.Collection"
    ],
    // Skip typechecking `.d.ts` files for a ~20% speed boost
    // Won't be necessary if https://github.com/microsoft/TypeScript/issues/30511 is ever resolved
    "skipLibCheck": true,
    "moduleResolution": "bundler",
    "resolveJsonModule": true,
    "esModuleInterop": true,
    "sourceMap": false,
    "allowJs": false,
    "allowImportingTsExtensions": true, // needed for Vite
    "strict": false, // TODO: Enable this eventually
    "exactOptionalPropertyTypes": true,
    "strictNullChecks": true,
    "strictBindCallApply": true,
    "strictBuiltinIteratorReturn": true,
    "strictFunctionTypes": true,
    // TODO: Enable this if TypeScript ever improves it to be smarter (e.g. to follow into `this.init()` type methods)
    "strictPropertyInitialization": false,
    // TODO: Enable this when possible.
    "noImplicitAny": false,
    "noImplicitThis": true,
    // Even with strict mode on, this is not useful as we do not throw non Errors,
    // and it just makes it more cumbersome to catch errors.
    "useUnknownInCatchVariables": false,
    "rootDir": ".",
    "outDir": "./build",
    // Note: We actively CANNOT UNDER ANY CIRCUMSTANCES enable declaration emit, as main repo code uses
    // mixins for classes with private/protected members (causing TS4094 errors).
    // (This also means we cannot use `composite` or project references in any capacity.)
    // See: https://github.com/microsoft/TypeScript/issues/17744
    "noEmit": true,
    //! Note: make sure more specific paths appear before less specific paths
    "paths": {
      "#abilities/*": ["./src/data/abilities/*.ts"],
      "#ai/*": ["./src/ai/*.ts"],
      "#api/*": ["./src/api/*.ts"],
      "#audio/*": ["./src/audio/*.ts"],
      "#biomes/*": ["./src/data/balance/biomes/*.ts"],
      "#balance/*": ["./src/data/balance/species/*.ts", "./src/data/balance/moves/*.ts", "./src/data/balance/*.ts"],
      "#constants/*": ["./src/constants/*.ts"],
      "#enums/*": ["./src/enums/*.ts"],
      "#events/*": ["./src/events/*.ts"],
      "#field/*": ["./src/field/*.ts"],
      "#init/*": ["./src/init/*.ts"],
      "#inputs/*": ["./src/configs/inputs/*.ts"],
      "#modifiers/*": ["./src/modifier/*.ts"],
      "#moves/*": ["./src/data/moves/*.ts"],
      "#mystery-encounters/*": [
        "./src/data/mystery-encounters/utils/*.ts",
        "./src/data/mystery-encounters/encounters/*.ts",
        "./src/data/mystery-encounters/requirements/*.ts",
        "./src/data/mystery-encounters/*.ts"
      ],
      "#package.json": ["./package.json"],
      "#phases/*": ["./src/phases/*.ts"],
      "#plugins/*": ["./plugins/phaser/*.ts"],
      "#queues/*": ["./src/queues/*.ts"],
      "#sprites/*": ["./src/sprites/*.ts"],
      "#system/*": [
        "./src/system/ribbons/*.ts",
        "./src/system/settings/*.ts",
        "./src/system/version-migration/versions/*.ts",
        "./src/system/version-migration/*.ts",
        "./src/system/*.ts"
      ],
      "#trainers/*": ["./src/data/trainers/*.ts"],
      "#types/*": ["./src/@types/*.ts"],
      "#ui/*": [
        "./src/ui/battle-info/*.ts",
        "./src/ui/containers/*.ts",
        "./src/ui/handlers/*.ts",
        "./src/ui/settings/*.ts",
        "./src/ui/utils/*.ts",
        "./src/ui/*.ts"
      ],
      "#utils/*": ["./src/utils/*.ts"],
      "#data/*": ["./src/data/daily-seed/*.ts", "./src/data/*.ts"],

      // these must always be last
      "#test/*": ["./test/*.ts"],
      "#app/*": ["./src/globals/*.ts", "./src/*.ts"]
    }
  },
  // We cannot use a blanket "**/*.ts" include here excluding `scripts` because it would bar us from checking any boilerplate files,
  // which should be valid under _main repo_ settings.
  // (`scripts` has its own TSConfig with extra subpath aliases, so attempting to typecheck them would cause errors about missing modules.)
  // We also don't add the `.github/scripts/` directory here as those files
  // need different settings to ensure they can be run by Node without issues.
  "include": ["*.ts", "src", "test", "scripts/**/*.boilerplate.ts"],
  "exclude": ["assets", "dist", "locales", "node_modules"]
}