TypeScript Academy · Lesson

Module and Target Configuration

Choose correct module, target, and lib settings.

Lesson 2 of 413 steps

Module and Target Configuration is a free TypeScript Academy lesson on CoddyKit. This is lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the TypeScript Academy learning path, and your progress syncs across the web and the CoddyKit app. The TypeScript Academy course includes 4 lessons in total.

Welcome

The module and target settings in tsconfig control which JavaScript syntax TypeScript compiles to.

target Setting

target controls which JavaScript syntax features are emitted. ES2020 is a safe modern default.
{ "compilerOptions": { "target": "ES2020" } }

Common Targets

ES5 for legacy browsers. ES2020+ for modern environments. ESNext for cutting-edge.

module Setting

module controls the module system in the emitted JS: commonjs, ES2020, NodeNext, bundler.
{ "compilerOptions": { "module": "commonjs" } }
// For ESM: "module": "ES2020" or "NodeNext"

moduleResolution

How TypeScript finds modules. Use node16 or bundler for modern projects.
{ "compilerOptions": { "moduleResolution": "bundler" } }

esModuleInterop

Allows default imports from CommonJS modules without * as syntax.
{ "compilerOptions": { "esModuleInterop": true } }
import express from 'express'; // instead of * as express

lib Setting

lib specifies which built-in APIs are available (DOM, ES2020, etc.).
{ "compilerOptions": { "lib": ["ES2020", "DOM"] } }

isolatedModules

Ensures each file can be transpiled independently — required by esbuild/Babel.
{ "compilerOptions": { "isolatedModules": true } }

verbatimModuleSyntax

Enforces import type usage for type-only imports. Replaces old importsNotUsedAsValues.
{ "compilerOptions": { "verbatimModuleSyntax": true } }

jsx Setting

For React projects, set jsx to react-jsx or react.
{ "compilerOptions": { "jsx": "react-jsx" } }

resolveJsonModule

Allows importing JSON files with type inference.
{ "compilerOptions": { "resolveJsonModule": true } }

Quick Check

What does the `target` option in tsconfig control?

Recap

Module and Target Configuration: mastered the key concepts and patterns.
Free to start

Learn TypeScript with an AI tutor — free

Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.

Courses
101
Lessons
352

Frequently Asked Questions

Is the “Module and Target Configuration” lesson free?

Yes — the full text of “Module and Target Configuration” is free to read here on the web. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the TypeScript Academy course, upgrade to CoddyKit PRO. The TypeScript Academy course includes 4 lessons in total.

What will I learn in “Module and Target Configuration”?

Choose correct module, target, and lib settings. You practise TypeScript Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start TypeScript Academy?

No prior experience is required. TypeScript Academy on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 2 of 4.

How long does the “Module and Target Configuration” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this TypeScript Academy lesson?

Yes. Every TypeScript Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. The strict Flag and What It Enables
  2. Module and Target Configuration
  3. Path Aliases and baseUrl
  4. Incremental Builds and Declaration Files
← Back to TypeScript Academy