A language that you can write code in that compiles down to JavaScript. It’s 99% JavaScript, though there are custom things.
A type syntax system that can define object schemas.
A type checker system for both JavaScript and Typescript files.
Generally, people use all three at once (.ts files), but you don’t have to. Types aren’t runtime code and can be mixed into the same file you are working on, even inline. Or you can use a separate d.ts file. Or you can use JSDocs.
You can also ask the Typescript checker (bundled with the compiler) to perform type checking on your .js or .ts with a slew of custom options. Commonly, when working with .ts, if the type checker fails against the ruleset, it won’t continue on to transcompiling to .js.
Typescript is 3 things:
Generally, people use all three at once (
.ts
files), but you don’t have to. Types aren’t runtime code and can be mixed into the same file you are working on, even inline. Or you can use a separated.ts
file. Or you can use JSDocs.You can also ask the Typescript checker (bundled with the compiler) to perform type checking on your
.js
or.ts
with a slew of custom options. Commonly, when working with.ts
, if the type checker fails against the ruleset, it won’t continue on to transcompiling to.js
.