Home

TSC

tsc is the TypeScript compiler, a command-line tool that compiles TypeScript code into JavaScript. It is part of the TypeScript language project maintained by Microsoft. TypeScript is a typed superset of JavaScript that adds optional static types and other features. When tsc processes .ts and .tsx files, it performs type checking (when enabled) and emits JavaScript according to the configured output settings.

The compiler is distributed via npm as the typescript package. Developers install it in their project or

Key options include target (es5, es2015, es2016, etc.), module (commonjs, esnext), lib, strict, noImplicitAny, skipLibCheck, outDir,

Typical usage: install TypeScript (npm i -D typescript), run npx tsc --init to create tsconfig.json, then run

globally
and
run
tsc
to
perform
compilation.
A
project
can
be
configured
with
a
tsconfig.json
file,
which
specifies
compiler
options,
file
inclusions,
exclusions,
and
references.
tsc
can
run
in
watch
mode
(-w)
to
recompile
on
changes,
and
supports
incremental
compilation
for
faster
builds.
It
can
emit
declaration
files
(.d.ts)
to
provide
type
information
to
consumers
of
a
library.
rootDir,
baseUrl,
paths,
etc.
It
can
resolve
module
imports,
handle
JSX
in
.tsx
files,
and
support
interop
with
non-TypeScript
code.
It
also
supports
project
references
to
build
multi-package
workspaces.
npx
tsc
to
compile.
Use
tsc
-w
or
tsc
--watch
for
automatic
recompilation.
The
output
is
JavaScript
files
in
the
configured
directory
along
with
optional
source
maps.