A base for TypeScript projects.
If I should maintain this repo, please
DM me on Twitter if you have questions or suggestions.
This package includes typescript
, ts-node
, and a base tsconfig.json
, providing a quick way to start TypeScript projects.
Installation
yarn add --dev @autosoft/tsconfig
npm install --save-dev @autosoft/tsconfig
pnpm add --save-dev @autosoft/tsconfig
Usage
In your tsconfig.json
file:
{
"extends": "@autosoft/tsconfig"
}
TSC
To run TSC, run yarn tsc
or npm run tsc
.
TS-Node
To run TS-Node, run yarn ts-node
or npm run ts-node
.
For ESM, run yarn ts-node-esm
or npm run ts-node-esm
.
TSConfig
The config enable strict type checking, and includes SWC for ts-node:
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"declaration": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"lib": [
"ESNext",
"DOM"
],
"module": "ESNext",
"moduleResolution": "Node",
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"removeComments": false,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "ES2019"
},
"ts-node": {
"esm": true,
"swc": true
}
}
Dependencies
- @swc/core: Super-fast alternative for babel
- @types/node: TypeScript definitions for Node.js
- ts-node: TypeScript execution environment and REPL for node.js, with source map support
- typescript: TypeScript is a language for application scale JavaScript development
Dev Dependencies
- jsonlint: Validate JSON