Skip to content

Standardize tsconfig.json across all TypeScript packages in the monorepo #335

Description

@Lakes41

Background

Multiple build failures point to inconsistent or missing TypeScript configuration across packages. The workspace includes packages with TypeScript builds (e.g., packages/contracts, packages/env, packages/integration-client, packages/webhook-utils) and apps (apps/docs, apps/discord-bot, apps/access-api, apps/dashboard), each potentially with different or incomplete tsconfig.json settings.

Problem

Inconsistent TypeScript configurations lead to:

  1. Unpredictable output paths (some emit to dist/, others elsewhere or nowhere)
  2. Mixed declaration/JavaScript emission strategies
  3. Different module resolution and target settings across the monorepo
  4. Difficulty maintaining and debugging builds
  5. Incompatible imports when packages don't emit expected file types

Expected Outcome

All TypeScript packages and apps follow a consistent configuration baseline:

  • Shared base tsconfig.json in the workspace root
  • Each package/app tsconfig.json extends the base and overrides only as needed
  • Consistent outDir, declaration, emitDeclarationOnly, module, target, and moduleResolution across the repo
  • Clear, predictable file output structure

Suggested Implementation

  1. Create a shared tsconfig.base.json in the workspace root with common settings:
    {
      "compilerOptions": {
        "target": "es2020",
        "module": "esnext",
        "lib": ["es2020"],
        "moduleResolution": "bundler",
        "declaration": true,
        "declarationMap": true,
        "sourceMap": true,
        "outDir": "./dist",
        "rootDir": "./src",
        "strict": true,
        "esModuleInterop": true,
        "skipLibCheck": true,
        "forceConsistentCasingInFileNames": true
      }
    }
  2. Update each package/app tsconfig.json to extend tsconfig.base.json
  3. Override only package-specific settings (e.g., outDir for monorepo structure)
  4. Run pnpm -r build to verify consistency
  5. Document the baseline in tsconfig.base.json comments

Acceptance Criteria

  • tsconfig.base.json exists in the workspace root with shared, sensible defaults
  • All packages in packages/ have tsconfig.json extending tsconfig.base.json
  • All apps in apps/ have tsconfig.json extending tsconfig.base.json
  • Full workspace build pnpm -r build succeeds
  • Output directories are predictable (dist/ or as needed per package type)
  • TypeScript strict mode is enabled consistently

Affected Files/Directories

  • tsconfig.json (workspace root)
  • tsconfig.base.json (create)
  • All */tsconfig.json files in packages/ and apps/

Metadata

Metadata

Assignees

Labels

Third CampaignOfficial FWC26 campaign issue — eligible for campaign scoring and rewardsconsistencyPattern and convention standardization across the codebase for uniformityintermediateIntermediate difficulty tasks requiring solid experience and some contexttype-safetyTypeScript type system improvements and strict type enforcement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions