npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rajzik/tsconfig

v4.0.4

Published

Pre-packaged tsconfig.json's for personal configured projects

Readme

@rajzik/tsconfig

Shareable TypeScript configuration with strict type checking and modern JavaScript support.

Installation

npm install --save-dev @rajzik/tsconfig typescript
pnpm install --save-dev @rajzik/tsconfig typescript
yarn add --dev @rajzik/tsconfig typescript

Usage

Base Configuration

Extend the base configuration in your tsconfig.json:

{
  "extends": "@rajzik/tsconfig"
}

Package Configuration

For packages that need to emit declaration files:

{
  "extends": "@rajzik/tsconfig/tsconfig.package.json"
}

Or reference the file directly:

{
  "extends": "@rajzik/tsconfig/tsconfig.package.json"
}

API Reference

Base Configuration (@rajzik/tsconfig)

The base configuration provides a modern TypeScript setup optimized for bundlers and modern tooling.

Configuration:

{
  "$schema": "https://json.schemastore.org/tsconfig",
  "display": "Rajzik config",
  "compilerOptions": {
    /* Base options */
    "esModuleInterop": true,
    "skipLibCheck": true,
    "target": "es2024",
    "lib": ["ES2024"],
    "allowJs": true,
    "resolveJsonModule": true,
    "moduleDetection": "force",
    "isolatedModules": true,
    "allowArbitraryExtensions": true,
    "jsx": "preserve",

    /* Keep TSC performant in monorepos */
    "incremental": true,
    "disableSourceOfProjectReferenceRedirect": true,
    "tsBuildInfoFile": "${configDir}/.cache/tsbuildinfo.json",

    /* Strictness */
    "strict": true,
    "checkJs": true,
    "noUncheckedIndexedAccess": true,

    /* Transpile using bundler */
    "module": "preserve",
    "moduleResolution": "bundler",
    "noEmit": true
  },
  "exclude": ["node_modules", "dist", "dts", ".next", "build"]
}

Key Features:

Base Options

  • esModuleInterop: Enables interoperability between CommonJS and ES Modules
  • skipLibCheck: Skips type checking of declaration files for faster compilation
  • target: es2024 - Latest ECMAScript features
  • lib: ["ES2024"] - Latest standard library types
  • allowJs: Allows JavaScript files to be imported
  • resolveJsonModule: Allows importing JSON files
  • moduleDetection: "force" - Treats all files as modules
  • isolatedModules: Ensures each file can be safely transpiled independently
  • allowArbitraryExtensions: Allows importing files with arbitrary extensions
  • jsx: "preserve" - Preserves JSX for bundler processing

Performance (Monorepo Optimized)

  • incremental: Enables incremental compilation
  • disableSourceOfProjectReferenceRedirect: Improves performance in monorepos
  • tsBuildInfoFile: Stores incremental compilation info in .cache/tsbuildinfo.json

Strictness

  • strict: Enables all strict type checking options
    • strictNullChecks
    • strictFunctionTypes
    • strictBindCallApply
    • strictPropertyInitialization
    • noImplicitThis
    • alwaysStrict
  • checkJs: Type checks JavaScript files
  • noUncheckedIndexedAccess: Requires explicit checks for array/object access

Bundler Mode

  • module: "preserve" - Preserves module syntax for bundlers
  • moduleResolution: "bundler" - Modern resolution strategy for bundlers
  • noEmit: Doesn't emit files (bundler handles transpilation)

Exclusions

Excludes common build and dependency directories:

  • node_modules
  • dist
  • dts
  • .next
  • build

Package Configuration (@rajzik/tsconfig/tsconfig.package.json)

Extended configuration for packages that need to emit TypeScript declaration files.

Configuration:

{
  "$schema": "https://json.schemastore.org/tsconfig",
  "extends": "./base.json",
  "compilerOptions": {
    /** Emit types for internal packages to speed up editor performance. */
    "declaration": true,
    "declarationMap": true,
    "emitDeclarationOnly": true,
    "noEmit": false,
    "outDir": "${configDir}/dist"
  }
}

Additional Options:

  • declaration: Generates .d.ts declaration files
  • declarationMap: Generates .d.ts.map source maps for better IDE support
  • emitDeclarationOnly: Only emits declaration files (no JavaScript)
  • noEmit: false - Allows emitting files
  • outDir: Output directory for declaration files

Use Case:

  • Internal packages in monorepos
  • Libraries that need to provide types to consumers
  • Packages where type-only emission improves editor performance

Configuration Options Explained

target: "es2024"

Compiles to ES2024 syntax. Modern bundlers will further transpile as needed for target environments.

Benefits:

  • Access to latest JavaScript features
  • Smaller output when targeting modern environments
  • Better tree-shaking support

module: "preserve"

Preserves module syntax (import/export) for bundler processing.

Benefits:

  • Bundlers can optimize module resolution
  • Better tree-shaking
  • Supports modern module formats

moduleResolution: "bundler"

Uses bundler-friendly module resolution strategy.

Features:

  • Supports package.json exports field
  • Handles modern module formats
  • Optimized for bundler tooling

Note: Requires TypeScript 5.0+


strict: true

Enables all strict type checking options:

  • strictNullChecks: null and undefined are separate types
  • strictFunctionTypes: Stricter function type checking
  • strictBindCallApply: Stricter bind, call, apply checking
  • strictPropertyInitialization: Requires class properties to be initialized
  • noImplicitThis: Error on implicit this usage
  • alwaysStrict: Parses in strict mode

Benefits:

  • Catches more errors at compile time
  • Better type safety
  • Prevents common runtime errors

noUncheckedIndexedAccess: true

Requires explicit checks when accessing arrays or objects by index.

Example:

// ❌ Error: Object is possibly 'undefined'
const value = obj['key'];

// ✅ Valid: Explicit check
const value = obj['key'] ?? defaultValue;

// ✅ Valid: Type guard
if ('key' in obj) {
  const value = obj['key']; // Now safe
}

Benefits:

  • Prevents undefined access errors
  • Encourages defensive programming
  • Better runtime safety

jsx: "preserve"

Preserves JSX syntax for bundler/transformer processing.

Use Cases:

  • React with modern bundlers (Vite, esbuild, etc.)
  • Next.js
  • Other JSX transformers

Alternatives:

  • "react" - For React 17+
  • "react-jsx" - For React 17+ with new JSX transform
  • "react-native" - For React Native

Extending the Configuration

Override Options

{
  "extends": "@rajzik/tsconfig",
  "compilerOptions": {
    "target": "es2022",
    "jsx": "react-jsx",
    "baseUrl": "./src",
    "paths": {
      "@/*": ["./src/*"]
    }
  }
}

Add Path Mappings

{
  "extends": "@rajzik/tsconfig",
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@components/*": ["./src/components/*"],
      "@utils/*": ["./src/utils/*"],
      "@types/*": ["./src/types/*"]
    }
  }
}

Include/Exclude Files

{
  "extends": "@rajzik/tsconfig",
  "include": ["src/**/*"],
  "exclude": ["node_modules", "dist", "**/*.test.ts"]
}

Monorepo Usage

Root tsconfig.json

{
  "extends": "@rajzik/tsconfig",
  "compilerOptions": {
    "composite": true,
    "references": [
      { "path": "./packages/package-a" },
      { "path": "./packages/package-b" }
    ]
  }
}

Package tsconfig.json

{
  "extends": "@rajzik/tsconfig/tsconfig.package.json",
  "compilerOptions": {
    "composite": true,
    "outDir": "./dist"
  },
  "references": [{ "path": "../shared" }]
}

Benefits:

  • Incremental compilation
  • Project references for faster builds
  • Shared type definitions

Migration Guide

From Older Configurations

If migrating from a different TypeScript config:

  1. Update moduleResolution: Change from "node" to "bundler" (if using modern bundlers)
  2. Update module: Change from "esnext" to "preserve" (if using bundlers)
  3. Enable noUncheckedIndexedAccess: May require adding null checks
  4. Review target: Update to "es2024" if targeting modern environments

Common Issues

Issue: Cannot find module errors Solution: Ensure moduleResolution: "bundler" and check package.json exports field

Issue: JSX not working Solution: Set jsx: "react-jsx" or jsx: "preserve" based on your setup

Issue: Slow compilation in monorepos Solution: Enable incremental: true and use project references


Examples

React Application

{
  "extends": "@rajzik/tsconfig",
  "compilerOptions": {
    "jsx": "react-jsx",
    "baseUrl": "./src",
    "paths": {
      "@/*": ["./*"]
    }
  },
  "include": ["src"]
}

Next.js Application

{
  "extends": "@rajzik/tsconfig",
  "compilerOptions": {
    "jsx": "preserve",
    "plugins": [
      {
        "name": "next"
      }
    ]
  },
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"]
}

Node.js Library

{
  "extends": "@rajzik/tsconfig",
  "compilerOptions": {
    "module": "node16",
    "moduleResolution": "node16",
    "target": "es2022"
  }
}

Monorepo Package

{
  "extends": "@rajzik/tsconfig/tsconfig.package.json",
  "compilerOptions": {
    "composite": true,
    "outDir": "./dist"
  },
  "references": [{ "path": "../shared" }]
}

Related Packages