

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 5
click for more info
Not enough gems
Cost: 6 gems
1: Welcome to Build a Pokedex
incomplete
2: Build
incomplete
3: Tests
incomplete
4: REPL
incomplete
5: Help and Exit
incomplete
This lesson's interactive features are locked, please to keep using them
By the end of this step, you'll have a simple working program in Node!
npm install -D typescript @types/nodeThe -D flag installs the packages as development dependencies, which means they won't be included in your production build.
{
"compilerOptions": {
"types": ["node"],
"target": "esnext",
"module": "nodenext",
"rootDir": "./src",
"outDir": "./dist",
"strict": true,
"moduleResolution": "nodenext",
"esModuleInterop": true,
"skipLibCheck": true
},
"include": ["./src/**/*.ts"],
"exclude": ["node_modules"]
}types includes Node.js type declarations
rootDir is where your TypeScript files are located
outDir is where your compiled JavaScript files will go (you won't modify these - they're generated from your TypeScript files)
include specifies the files to include in the compilation
exclude specifies the files to exclude from the compilation
strict enables all strict type checking options
esModuleInterop allows you to use ES module syntax
moduleResolution specifies how modules are resolved
skipLibCheck skips type checking all declaration files
{
...
"type": "module",
"scripts": {
"build": "npx tsc",
"start": "node dist/main.js",
"dev": "npx tsc && node dist/main.js"
},
...
}The npx command allows us to run the tsc command without installing TypeScript globally.
function main() {
console.log("Hello, world!");
}
main();npm run devIf you see "Hello, world!" printed in the console, you're good to go!
Run and submit the CLI tests.