//
// @naturalcycles/js-lib/cfg/frontend/tsconfig.json
//
// Shared tsconfig for Frontend applications
//
{
  "compilerOptions": {
    // Target/module
    "target": "es2020", // es2020+ browsers, adjust to your requirements!
    "lib": ["esnext", "dom", "dom.iterable"],
    "module": "esnext",
    "moduleResolution": "node",
    "moduleDetection": "force",
    // specifying these explicitly for better IDE compatibility (but they're on by default with module=nodenext)
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    // Faster compilation in general
    // Support for external compilers (e.g esbuild)
    // Speedup in Jest by using "isolatedModules" in 'ts-jest' config
    "isolatedModules": true,

    // Emit
    "sourceMap": false,
    "declaration": false,
    // Otherwise since es2022 it defaults to true
    // and starts to produce different/unexpected behavior
    // https://angular.schule/blog/2022-11-use-define-for-class-fields
    "useDefineForClassFields": false,
    "importHelpers": true,

    // Strictness
    "strict": true,
    "noFallthroughCasesInSwitch": true,
    "forceConsistentCasingInFileNames": true,
    "resolveJsonModule": true,
    "suppressImplicitAnyIndexErrors": false,
    "noUncheckedIndexedAccess": true,
    "noUncheckedSideEffectImports": true,
    "noPropertyAccessFromIndexSignature": true,
    "noImplicitOverride": true,

    // Enabled should be faster, but will catch less errors
    // "skipLibCheck": true,

    // Disabled because of https://github.com/Microsoft/TypeScript/issues/29172
    // Need to be specified in the project tsconfig
    // "outDir": "dist",
    // "rootDir": "./src",
    //  "baseUrl": "./",
    //  "paths": {
    //    "@src/*": ["src/*"]
    //  },
    // "typeRoots": [
    //   "node_modules/@types",
    //   "src/@types"
    // ],

    // Other
    "jsx": "preserve",
    "pretty": true,
    "newLine": "lf",
    "experimentalDecorators": true,
    // "emitDecoratorMetadata": true // use if needed
  },
  // Need to be specified in the project tsconfig
  // "include": ["src"],
  // "exclude": ["**/__exclude", "**/@linked"]
}
