@oldbros/tsconfig
v1.0.2
Published
Oldbros typescript configuration
Downloads
6
Maintainers
Readme
@oldbros/tsconfig
OldBros recommended typescript configuration
Installing
npm install --save-dev @oldbros/tsconfig
Usage
Add this line to your tsconfig.json
file:
{
"extends": "@oldbros/tsconfig"
}
Add check script to your package.json
file:
{
"scripts": {
"check": "npx tsc --project ."
}
}
Run npm run check
command to check js files with ts compiler
Features
- Support latest ECMAScript2022 language features
- Uses ECMAScript Modules
- Recommended for NodeJS v18 and higher
- No typescript experimental features
Description
This configuration is to check JavaScript with TypeScript compiler.
Why doesn't OldBros use TypeScript as a main language:
- There is no TypeScript RFC. Nobody knows what TypeScript actually is in details.
- TypeScript is not a JavaScript superset. It does not support all JavaScript syntax such as
await new
and many others - TypeScript specific features. Enums, Namespaces, Decorators,
private
keyword (there are native js private fields)
Why OldBros uses TypeScript compiler for JavaScript:
- Explicit interfaces. They are especially useful for designing libraries and applications.
- IDE autocompletion and hints. Those are quite useful during development time.
- More elegant than JSDoc. The problem with JSDoc - it is quite heavy compare to TypeScript types.
- Disctinct types and interfaces declarations with
d.ts
files are sometimes useful.