TypeScript
TypeScript is a strongly typed programming language that builds on JavaScript, giving you better tooling at any scale.
Installation
Install the TypeScript configuration using the ServerCN CLI:
npx servercn-cli add tooling typescriptConfiguration
The component provides a tsconfig.json file optimized for modern Node.js backend development.
tsconfig.json
1. Minimal
2. Advanced
Scripts
Add the following scripts to your package.json:
Using Nodemon (Optional)
If you prefer nodemon, add a nodemon.json file:
Then update your scripts:
Features
- Strict Type Checking: Enabled by default to catch bugs early.
- Modern ES Support: Pre-configured for the latest ECMAScript features.
- Source Maps: Configured for easier debugging.
- Clean Output: Separates source code from compiled JavaScript.
Add More Tooling
npx servercn-cli add tooling commitlint husky eslint prettier lint-staged typescript