typescript run

1094 단어 typescripttypescript

References

https://sddev.tistory.com/91
https://www.npmjs.com/package/ts-node

install

# Locally in your project. 
npm install -D typescript
npm install -D ts-node
 
# Or globally with TypeScript. 
npm install -g typescript
npm install -g ts-node

and i recommand global install

run

# Execute a script as `node` + `tsc`. 
ts-node script.ts
 
# Starts a TypeScript REPL. 
ts-node
 
# Execute code with TypeScript. 
ts-node -e 'console.log("Hello, world!")'
 
# Execute, and print, code with TypeScript. 
ts-node -p -e '"Hello, world!"'
 
# Pipe scripts to execute with TypeScript. 
echo 'console.log("Hello, world!")' | ts-node
 
# Equivalent to ts-node --script-mode 
ts-node-script scripts.ts
 
# Equivalent to ts-node --transpile-only 
ts-node-transpile-only scripts.ts

and i use ts-node test.ts

see ya :)

좋은 웹페이지 즐겨찾기