起步
2023/4/28小于 1 分钟
起步
安装 TypeScript
mkdir playground
cd playground
# please install yarn before next command
yarn init
yarn add typescriptHello World
main.ts:
function helloWorld(name: string) {
console.log(`I am ${name}, hello TypeScript!`);
}
const me = 'PPG007';
helloWorld(me);然后执行 tsc main.ts,此时会得到一个 main.js 文件,这个文件就是执行编译的结果,执行这个 js 文件即可。