This task invokes the compiler for the TypeScript programming language.
When to use it
TypeScript is the standard programming language for Rush Stack. There are many benefits to having one "lingua franca" across all coding investments, rather than having to maintain different expertise and libraries for different languages.
We recommend TypeScript for:
- Application development: It's even a good choice for prototypes and small experiments.
- Tooling infrastructure: A great developer experience multiplies everyone's productivity, so build tools should be treated as first-class software projects with their own designs, documentation, and tests.
- Device apps: Where possible, TypeScript can also be used for native development via runtime hosts such as React Native.
- Desktop apps: There are also runtime hosts such as Electron for making desktop apps.
Obviously certain components may inevitably require Java, C++, Swift, etc. But ideally developers should not be required to install native SDKs unless they're working on those components. The Expo client takes this concept to an extreme, enabling you to compile and run a phone app without installing native tools at all. This ideal isn't always feasible in practice, of course. It's a mentality, not a dogma. The main point is that there are significant benefits to normalizing the code base so that any engineer can easily contribute to any project, and any project can load any library.
You will need to add the
typescript package to your project:
rush add --package typescript --dev
Alternatively, you can avoid this dependency by loading it from a "rig package", as described in the Interfacing with Rush article.
If your tsconfig.json enables
"importHelpers": true for more efficient transpiler output, you may also need a dependency on tslib:
rush add --package tslib
The primary configuration comes from TypeScript's tsconfig.json file.
For advanced scenarios, Heft also provides an optional typescript.json config file that can be used to configure toolchain features such as multiple emit targets for the TypeScript compiler.