
$ ls *
main.js package.json
hello:
hello.js
$
{
"name": "fourier",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node main.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
$ npm install typescript ts-node @types/node
added 19 packages, and audited 20 packages in 39s
found 0 vulnerabilities
$ ls
hello node_modules package.json
main.js package-lock.json
$ npx tsc --init
Created a new tsconfig.json with:
TS
target: es2016
module: commonjs
strict: true
esModuleInterop: true
skipLibCheck: true
forceConsistentCasingInFileNames: true
You can learn more at https://aka.ms/tsconfig
$
...
"scripts": {
"start": "npx ts-node main.ts",
"test": "echo \"Error: no test specified\" && exit 1"
},
...
$ find . -not -path "./node_modules/*"
.
./main.ts
./node_modules
./package-lock.json
./package.json
./tsconfig.json
./hello
./hello/hello.ts
$
$ npm start
> fourier@1.0.0 start
> npx ts-node main.ts
Hello World
OS Info ==> Type Darwin Release: 21.6.0 Platform: darwin
$