ts 全局安装
npm i typescript -g
ts 转化 js
tsc hello.ts
解决ts与js冲突
- tsc -- init // 生成配置文件
- 自动编译 tsc --watch
- 发出错误 tsc -noEmitOnError hello,ts
显示类型
function green (people: string, date: Date) {
console.log(`111 ${people}---${date.toDateString()}`);
}
green('11', new Date())
降级编译 默认编译 es2016