Get Personalized Learning Experience

Most tutorials treat everyone the same. OpenLume adapts to your skills, pace, and goals.

Access tailored content, assessments, and mock interviews — all in one place.

Back to Software Developer in Test (SDET) (Playwright, TypeScript) 90-day Learning Plan

Configure TypeScript in the project (tsconfig.json)

Introduction

Now that you've set up Node.js, npm, your project folder, and Playwright, it's time to configure TypeScript for your SDET workflow. This topic will guide you step-by-step through creating and customizing the tsconfig.json file—the heart of TypeScript configuration. Mastering this setup is crucial, as it ensures your code is type-checked and compiles correctly, setting a strong foundation for all the TypeScript and Playwright automation you'll build next.

What is tsconfig.json and Why Does It Matter?

The tsconfig.json file tells TypeScript how to process your code. It defines things like which files to include, where to output compiled JavaScript, and what language features to support. Think of it as the control panel for TypeScript in your project.

Without a proper tsconfig.json, TypeScript won’t know how to handle your files or enforce type safety—two things that are essential for robust automated testing.

Creating Your First tsconfig.json

Let’s create the default configuration. In your project root, run:

npx tsc --init

Key Sections of tsconfig.json Explained

When you open tsconfig.json, you'll see many options—don’t worry, we’ll focus on the most important ones for SDET and Playwright work:

  • compilerOptions: Controls how TypeScript compiles code (target version, module system, etc.)
  • include: Tells TypeScript which files/folders to type-check
  • exclude: Specifies files/folders to ignore (like node_modules)

Let’s break down some core settings you’ll want to adjust.

Essential compilerOptions for SDET Projects

Here are the most relevant options for a modern Playwright + TypeScript setup:

  • target: The JavaScript version output (usually "ESNext" or "ES2020")
  • module: Module system (use "commonjs" for Node.js)
  • outDir: Where compiled JS files go (commonly "dist" or "build")
  • rootDir: Where your source TS files live (often "src")
  • strict: Enables strict type-checking for safer code
  • esModuleInterop: Allows compatibility with CommonJS modules

Minimal tsconfig.json Example

{
  "compilerOptions": {
    "target": "ES2020",
    "module": "commonjs",
    "outDir": "dist",
    "rootDir": "src",
    "strict": true,
    "esModuleInterop": true
  },
  "include": ["src"],
  "exclude": ["node_modules"]
}

How These Settings Impact Your Workflow

  • target/module: Ensures compatibility with Node.js and modern JavaScript features
  • outDir/rootDir: Keeps source and compiled files organized
  • strict: Catches more bugs early—a huge benefit when writing tests
  • esModuleInterop: Lets you import libraries smoothly, including Playwright

As you write more tests and utilities, these settings help maintain clarity and reliability in your codebase.

Customizing Further (Optional)

As you grow more comfortable, you might tweak other options:

  • sourceMap: Generate source maps for easier debugging
  • types: Limit which type definitions are included (can help with test runners)
  • allowJs: If mixing JS/TS files temporarily

For now, stick with the basics above—advanced tweaks can come later as you explore more complex needs.

💡 Pro Tip: Always commit your tsconfig.json file to Git. This ensures everyone on your team uses the same TypeScript settings—avoiding mysterious bugs or inconsistent builds.

Get Personalized Learning Experience

Most tutorials treat everyone the same. OpenLume adapts to your skills, pace, and goals.

Access tailored content, assessments, and mock interviews — all in one place.