Skip to content

Instantly share code, notes, and snippets.

@armand1m
Last active August 29, 2021 13:23
Show Gist options
  • Save armand1m/f60c14c45e19a18071bcf5b7aa79237a to your computer and use it in GitHub Desktop.
Save armand1m/f60c14c45e19a18071bcf5b7aa79237a to your computer and use it in GitHub Desktop.
Install typescript in a node project
# Use the following command to run this code in your computer:
# curl -SLsf https://go.d1m.dev/installts | sh
yarn add -D typescript @types/node
yarn add tslib
cat > ./tsconfig.json <<EOL
{
"compilerOptions": {
"pretty": true,
"strict": true,
"removeComments": true,
"noImplicitReturns": true,
"noImplicitAny": true,
"noImplicitThis": true,
"alwaysStrict": false,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"forceConsistentCasingInFileNames": true,
"diagnostics": true,
"listEmittedFiles": true,
"importHelpers": true,
"noUnusedLocals": true,
"esModuleInterop": true,
"strictNullChecks": true,
"experimentalDecorators": true,
"isolatedModules": true,
"skipLibCheck": true,
"sourceMap": true,
"resolveJsonModule": true,
"declaration": true,
"target": "es6",
"module": "commonjs",
"jsx": "preserve",
"moduleResolution": "node",
"outDir": "./build",
"lib": ["es6", "es2015", "es2017", "esnext"],
"typeRoots": [
"./node_modules/@types"
],
"types": [
"node",
"jest"
],
},
"include": ["./src"],
"exclude": [
"node_modules",
"**/*.test.ts",
]
}
EOL
npx add-project-script -n "build" -v "tsc"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment