Quickly create a native Typescript runtime environment.
npm init -f
npm -D i typescript@4
npm -D i @types/node@12 @types/vscode@1
npm -D i ts-node
npm -g i https://github.com/zhmhbest/AttachConfiguration
attach package.json "main='src/index.ts'"
attach package.json "scripts>build='tsc -p ./'"
attach package.json "scripts>watch='tsc -watch -p ./'"
attach package.json "scripts>start='ts-node src/index.ts'"
mkdir src
mkdir .vscode
touch ./tsconfig.json
touch ./src/index.ts
touch ./.vscode/launch.json
tsconfig.json
{
"compilerOptions": {
"sourceMap": true,
"module": "CommonJS",
"target": "ES2016",
"lib": ["ES2016"],
"rootDir": "./src",
"outDir": "./out",
"strict": true,
"skipLibCheck": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noUnusedParameters": true,
},
"include": ["./src/**/*"],
"exclude": ["node_modules", "dist", "out"]
}
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug",
"type": "node",
"request": "launch",
"args": [
"${workspaceRoot}/src/index.ts"
],
"runtimeArgs": [
"--nolazy",
"-r",
"ts-node/register"
],
"sourceMaps": true,
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}
index.ts
function sayHello() {
console.log("Hello!");
}
sayHello();
Read More:
- Anaconda create environment, delete environment, activate environment, exit environment
- brew Error: Could not create /usr/local/Cellar
- The local program cannot access the test environment redis cluster through public IP_ compromise
- Running course of Kafka in Windows Environment
- Definition of bracket type in typescript
- “Fatal error: Unable to find local grunt.” when running “grunt” command
- CONDA failed to create environment (collecting package metadata(repodata.json): failed)
- About node error NPM update check failed try running with sudo or get access to the local update
- QT running prompt failed to create OpenGL context for format qsurfaceformat (version 2.0, options qflags() solution)
- After the vs2013 + OpenGL environment is set up, there is an error in running the first program
- Typescript generic source code error
- Quickly convert map to ordered array
- Typescript error “Cannot write file xxx because it would overwrite input file
- Solve the problem of Python in Windows environment: Fatal error in launcher: Unable to create process using’”‘ in pip installation
- How to Install Python 3 in Centos7 Quickly
- Quickly solve the problem of Vmware virtual machine “\\.\Global\vmx86”: the system cannot find the specified file
- Configuration of OpenGL development environment under Windows environment, win10 + vs2019 + glfw + glad
- Tdengine failed to start, start request repeated too quickly for taosd.service
- Error 1: Vue quickly clicks the route to jump. Error: uncaught (in promise) error: request aborted