当前位置:网站首页>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
结果如下
圆满结束
边栏推荐
- Detailed explanation of JVM memory layout, class loading mechanism and garbage collection mechanism
- Adaptive Control - Simulation Experiment 1 Designing Adaptive Laws Using Lyapunov's Stability Theory
- debian10 install djando
- Paper reading: SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers
- jmeter接口压力测试-(二)
- Redis Desktop Manager 2022.4.2 released
- 系统设计精选 | 基于FPGA的CAN总线控制器的设计(附代码)
- 360 released a future-oriented EDR to protect the security of government and enterprise user terminals in an all-round way
- 360发布面向未来的EDR,全方位守护政企用户终端安全
- 通过构建一个顺序表——教你计算时间复杂度和空间复杂度(含递归)
猜你喜欢

By building a sequence table - teach you to calculate time complexity and space complexity (including recursion)

If someone asks you about distributed transactions again, throw this to him

Re16:读论文 ILDC for CJPE: Indian Legal Documents Corpus for Court Judgment Prediction and Explanation

GNOME 新功能:安全启动被禁用时警告用户

类和对象—6个默认成员函数

BERT pre-training model series summary

Domino Server SSL Certificate Installation Guide

Meikle Studio-Look at Hongmeng Device Development Practical Notes 7-Network Application Development

flowable工作流所有业务概念

Meikle Studio-Look at the actual combat notes of Hongmeng device development six-wireless networking development
随机推荐
PyQt5 - draw sine curve with pixels
BERT pre-training model series summary
Scrapy爬虫之网站图片爬取
(C language) file operation
在机器人行业的专业人士眼里,机器人行业目前的情况如何?
Materialist Dialectics - Conditionalism
Shell system learning function
系统设计精选 | 基于FPGA的CAN总线控制器的设计(附代码)
Redis Desktop Manager 2022.4.2 released
Mysterious APT Attack
MySQL |子查询
Quick Start Tutorial for flyway
Flask之路由(app.route)详解
【C和指针第七章】可变参数列表
[AGC] Growth Service 2 - In-App Message Example
OC-ARC (Automatic Reference Counting) automatic reference counting
论文阅读:SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers
The thread pool method opens the thread -- the difference between submit() and execute()
电压跟随器不要随便加
PyQt5 - Drawing different types of straight lines