当前位置:网站首页>typescript入门之helloworld
typescript入门之helloworld
2022-07-30 10:14:00 【地图学】
typescript纯手工编写入门
一、创建目录和项目初始化
1、创建目录
mkdir hello
cd hello

2、项目初始化,创建package文件
npm init
二、安装依赖库
需要安装如下
typescript :用于编译ts文件
tslint:规范代码
@types/node :弄得规范
npm install typescript tslint @types/node --save-dev
结果生成目录如下
三、编写typescript 和tslint的配置文件
需要编写tsconfig.json和tslint.json
1、tsconfig
tsc支持命令
使用tsc --init生成默认配置文件
npx tsc --init
生成默认的tsconfig.json如下
修改默认配置
outDir 设置为‘dist’
2、tslint
tslint支持命令如下
使用 init命令
npx tslint --init
默认生成如下文件
4、编写代码
1、生成代码文件夹
mkdir src
2、编写代码
touch index.ts
console.log('hello world')
5、编译
npx tsc
会在dist文件夹下生成index.js
代码内容如下
说明编译成功
6、运行
node ./dist/index.js
结果如下
圆满结束
边栏推荐
- WEB3之路(一)-- solidity学习笔记
- Array of Shell System Learning
- [HarmonyOS] [ARK UI] How to double-click the return key to exit in HarmonyOS ets language
- Re17:读论文 Challenges for Information Extraction from Dialogue in Criminal Law
- (C语言)文件操作
- 梅科尔工作室-看鸿蒙设备开发实战笔记四——内核开发
- OC- about alloc and dealloc (haven't started writing yet)
- [Qualcomm][Network] 网络拨号失败和netmgrd服务分析
- MySQL |子查询
- 电压跟随器不要随便加
猜你喜欢

(***Key points***) Flink common memory problems and tuning guide (1)

神经网络学习笔记4——自动编码器(含稀疏,堆叠)(更新中)

Flask之路由(app.route)详解

Redis Desktop Manager 2022.4.2 released

vscode中写markdown格式笔记的配置过程和相关语法

Selected System Design | Design of CAN Bus Controller Based on FPGA (with Code)

BERT预训练模型系列总结

Re17: Read the paper Challenges for Information Extraction from Dialogue in Criminal Law
![idea2021+Activiti [the most complete note one (basic use)]](/img/60/55cccf257523bed2c8829361cea97c.png)
idea2021+Activiti [the most complete note one (basic use)]

RandLA-Net复现记录
随机推荐
【HMS core】【FAQ】HMS Toolkit典型问题合集1
Pytorch中 nn.Transformer的使用详解与Transformer的黑盒讲解
Linux内核设计与实现(十)| 页高速缓存和页回写
By building a sequence table - teach you to calculate time complexity and space complexity (including recursion)
自适应控制——仿真实验一 用李雅普诺夫稳定性理论设计自适应规律
EViews 12.0 software installation package download and installation tutorial
Verilog之数码管译码
Drag and drop events, dataTransfer, getBoundingClientRect
Flink_CDC搭建及简单使用
OC-ARC(Automatic Reference Counting)自动引用计数
【HMS core】【FAQ】HMS Toolkit典型问题合集1
The configuration process and related syntax of writing markdown format notes in vscode
PyQt5 - draw text on window
paging
Redis Desktop Manager 2022.4.2 发布
数据库脏读、不可重复读、幻读以及对应的隔离级别
你真的懂Redis的5种基本数据结构吗?
idea2021+Activiti [the most complete note one (basic use)]
类和对象—6个默认成员函数
梅科尔工作室-看鸿蒙设备开发实战笔记四——内核开发