当前位置:网站首页>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
结果如下
圆满结束
边栏推荐
- Re16: Read the paper ILDC for CJPE: Indian Legal Documents Corpus for Court Judgment Prediction and Explanation
- 电压跟随器不要随便加
- Easy gene: human tRNA gene loci showed age-related high DNA methylation | research articles
- 系统设计精选 | 基于FPGA的CAN总线控制器的设计(附代码)
- Neural Network Study Notes 3 - LSTM Long Short-Term Memory Network
- Domino服务器SSL证书安装指南
- 【 HMS core 】 【 Analytics Kit] [FAQ] how to solve the payment amount in huawei pay analysis shows zero problem?
- Drag and drop events, dataTransfer, getBoundingClientRect
- Scrapy crawler website image crawling
- Re20:读论文 What About the Precedent: An Information-Theoretic Analysis of Common Law
猜你喜欢
JVM内存布局、类加载机制及垃圾回收机制详解
死锁的理解
nacos实战项目中的配置
(C language) file operation
自适应控制——仿真实验一 用李雅普诺夫稳定性理论设计自适应规律
Meikle Studio - see the actual combat notes of Hongmeng equipment development five - drive subsystem development
从数据流中快速查找中位数
GNOME 新功能:安全启动被禁用时警告用户
梅科尔工作室-看鸿蒙设备开发实战笔记七——网络应用开发
Redis Desktop Manager 2022.4.2 released
随机推荐
Always remember: one day you will emerge from the chrysalis
第1章 Kali与靶机系统
Re16: Read the paper ILDC for CJPE: Indian Legal Documents Corpus for Court Judgment Prediction and Explanation
(BUG record) No module named PIL
MFCC to audio, the effect should not be too funny >V
数据库脏读、不可重复读、幻读以及对应的隔离级别
2022年顶会accepted papers list
105. Construct binary tree from preorder and inorder traversal sequence (video explanation!!)
Database dirty reads, non-repeatable reads, phantom reads and corresponding isolation levels
OC-ARC(Automatic Reference Counting)自动引用计数
[Qualcomm][Network] 网络拨号失败和netmgrd服务分析
梅科尔工作室-看鸿蒙设备开发实战笔记六—无线联网开发
mysql安装教程【安装版】
By building a sequence table - teach you to calculate time complexity and space complexity (including recursion)
【HMS core】【FAQ】HMS Toolkit典型问题合集1
OC-ARC (Automatic Reference Counting) automatic reference counting
Js array operating mobile for encapsulation
Basemap和Seaborn
OC - Manual Reference Counting Memory Management
从数据流中快速查找中位数