An Interest In:
Web News this Week
- April 19, 2024
- April 18, 2024
- April 17, 2024
- April 16, 2024
- April 15, 2024
- April 14, 2024
- April 13, 2024
February 20, 2022 07:54 am GMT
Original Link: https://dev.to/kaede_io/ts-wo-tsc-to-node-dedong-kasu-18df
TS tsc node
TypeScript
by SmartHR
===
npm i -g [email protected] 1 package, and audited 2 packages in 885msfound 0 vulnerabilities
npm i -g ts 4.3.5
===
ts
function sum(a:number, b: number) { return a + b}console.log(sum(1, 2));
sum.ts ts
===
tsc js
tsc sum.ts
function sum(a, b) { return a + b;}console.log(sum(1, 2));
tsc ts js
js VSCode OK
===
node js
node sum.js3
node js
tsc js
ts
===
ts
function sum(a:string, b: number) { return a + b}console.log(sum(1, 2));
ts
===
VS Code
vscode
===
tsc
tsc sum.tssum.ts:5:17 - error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.5 console.log(sum(1, 2)); ~Found 1 error.
tsc
====
ts-node ts
npm i -g ts-nodeadded 17 packages, and audited 18 packages in 2sfound 0 vulnerabilities
ts-node
npx ts-node sum.ts11
npx ts-node ts
Original Link: https://dev.to/kaede_io/ts-wo-tsc-to-node-dedong-kasu-18df
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To