# TypeScript Configuration and Tooling

> tsconfig options, declaration files, typing third-party code and keeping type checks in your workflow. Free notes, key concepts, resources and a mini project.

Canonical: https://www.internhack.in/roadmaps/tracks/frontend/typescript-tooling
Last updated: 2026-11-28

tsconfig options, declaration files, typing third-party code and keeping type checks in your workflow.

Intermediate · about 3 hours · difficulty 3/5

Learn first: [TypeScript Fundamentals](https://www.internhack.in/roadmaps/tracks/frontend/typescript-basics), [Build Tools and Bundlers](https://www.internhack.in/roadmaps/tracks/frontend/build-tools)

Knowing the type system is half the job; the other half is configuring a project so TypeScript helps rather than annoys.

### tsconfig.json essentials

- `strict`: turns on the checks that matter (`strictNullChecks`, `noImplicitAny` and friends).
- `target` and `lib`: which JavaScript features and built-in APIs (including `DOM`) are available.
- `module` and `moduleResolution`: use `"bundler"` for Vite-style apps and `"NodeNext"` for Node packages.
- `jsx`: `"react-jsx"` for React projects.
- `paths`: import aliases like `@/components` (the bundler must agree).
- `noEmit`: let the bundler produce JavaScript while `tsc` only type checks.
- Extra safety worth enabling: `noUncheckedIndexedAccess`, `exactOptionalPropertyTypes` (stricter, optional).

### Declaration files

Libraries ship types as `.d.ts` files, either bundled or via DefinitelyTyped (`@types/lodash`). For untyped modules or globals, write a small `declare module` shim. Vite projects use `vite-env.d.ts` to type `import.meta.env`.

### Workflow

- Bundlers like Vite and esbuild **strip** types without checking them. Run `tsc --noEmit` in a script and in CI.
- Use editor features: go to definition, rename symbol, quick fixes. They are the everyday payoff.
- Migrate JavaScript gradually with `allowJs` and `checkJs` if needed.

### Good enough to move on

You can read and adjust a tsconfig, add a path alias that works in both TypeScript and Vite, type environment variables and fix a "could not find a declaration file" error properly.

## Key concepts

- **tsconfig strict and target options**
- **moduleResolution and jsx settings**
- **Path aliases**
- **Declaration files and @types**
- **Type checking in CI with tsc --noEmit**
- **Typing import.meta.env**
- **Gradual migration from JavaScript**

## Mini project

Set up a Vite plus TypeScript project from scratch with strict mode, an @/ alias, typed environment variables, and a CI-ready typecheck script that fails on errors.

## Check yourself

If Vite builds your app successfully, why can it still contain type errors?

## Free resources

- [TSConfig Reference](https://www.typescriptlang.org/tsconfig/) (TypeScript)
- [Declaration Files](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html) (TypeScript)
- [Vite TypeScript features](https://vite.dev/guide/features#typescript) (Vite)

Previous: [Generics and Advanced Types](https://www.internhack.in/roadmaps/tracks/frontend/typescript-advanced) · Next: [Declarative UI and Component Thinking](https://www.internhack.in/roadmaps/tracks/frontend/component-thinking)

## More in TypeScript for Frontend Developers

- [TypeScript Fundamentals](https://www.internhack.in/roadmaps/tracks/frontend/typescript-basics)
- [Generics and Advanced Types](https://www.internhack.in/roadmaps/tracks/frontend/typescript-advanced)
- [TypeScript Configuration and Tooling](https://www.internhack.in/roadmaps/tracks/frontend/typescript-tooling)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Frontend Developer Roadmap](https://www.internhack.in/roadmaps/tracks/frontend)
