# Compilation

> The Compilation is a process of converting source code written in a high-level programming language into machine code that a computer can execute.

## What is compilation and how is a compiler different from an interpreter?

The process of translating source code into lower-level code, such as machine code or bytecode. During this process, a compiler checks for errors and produces output that a computer or virtual machine can run.

- Topic: Basics
- Type: concept, process

## Common mistakes

- The TypeScript build succeeds with type errors because the bundler only strips types.

## Key points

- The build runs a real type check, such as `tsc --noEmit`, since tools that only strip types do not report type errors.
- Compiled output folders are listed in `.gitignore`, not committed.

## Interview questions

### Compiled vs interpreted language: what is the difference?

A compiled language is translated before it runs. An interpreted one is read and run by an interpreter, though many modern runtimes mix both.

### Is JavaScript compiled or interpreted?

Both. Engines parse JavaScript to bytecode, interpret it and JIT-compile hot code to machine code while the program runs.

### Is TypeScript compiled?

Yes, it is compiled to JavaScript. By default `tsc` still emits files when there are type errors unless `noEmitOnError` is set.

## Related cards

- [tsc](https://wonderium.dev/ts/tsc.md)
- [Type Stripping](https://wonderium.dev/ts/type-stripping.md)
- [High-level Language](https://wonderium.dev/engineering/high-level-language.md)
- [Project Build](https://wonderium.dev/processes/project-build.md)
- [WebAssembly](https://wonderium.dev/web/webassembly.md)

---

- Level: [Engineering](https://wonderium.dev/engineering.md)
- HTML version: https://wonderium.dev/engineering/compilation
- Last updated: 2026-11-25
