typescript helloword

创建文件夹

创建ch01文件夹

新建tsconfig.json

{
    
    
    "compilerOptions": {
    
    
        "strict": true,
        "target": "ES5"
    }
}

“tsconfig.json”是TypeScript编译器默认使⽤的配置⽂件。此例中的配置⽂件启⽤了所有的严格类型检查编译选项,并将输出JavaScript的版本指定为ECMAScript 5

新建建hello-world.ts

const greeting = 'Hello World';
console.log(greeting);

启动项目

选择ctrl+shift+B
在这里插入图片描述
在这里插入图片描述
生成的js内容如下:

"use strict";
var greeting = 'Hello World';
console.log(greeting);

执行node hello-world.js
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_36437991/article/details/131678961