当前位置:网站首页>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
结果如下
圆满结束
边栏推荐
- Meikle Studio-Look at Hongmeng Device Development Practical Notes 7-Network Application Development
- Js array operating mobile for encapsulation
- BERT预训练模型系列总结
- In the robot industry professionals, Mr Robot industry current situation?
- 自适应控制——仿真实验一 用李雅普诺夫稳定性理论设计自适应规律
- Matplotlib--plot markers
- STM32CubeMX configuration to generate FreeRTOS project
- 关于verilog的时延研究
- Always remember: one day you will emerge from the chrysalis
- Determine whether a tree is a complete binary tree - video explanation!!!
猜你喜欢

Practical Walkthrough | Calculate Daily Average Date or Time Interval in MySQL

Easy gene: human tRNA gene loci showed age-related high DNA methylation | research articles

梅科尔工作室-看鸿蒙设备开发实战笔记五——驱动子系统开发

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

自适应控制——仿真实验一 用李雅普诺夫稳定性理论设计自适应规律

Meikle Studio-Look at the actual combat notes of Hongmeng device development six-wireless networking development

Security Thought Project Summary

线程池方式开启线程--submit()和execute()的区别

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

唯物辩证法-条件论
随机推荐
【C和指针第七章】可变参数列表
(C language) file operation
Flask's routing (app.route) detailed
js对数组操作移动进行封装
线上靶机prompt.ml
Meikle Studio-Look at Hongmeng Device Development Practical Notes 7-Network Application Development
【 HMS core 】 【 Analytics Kit] [FAQ] how to solve the payment amount in huawei pay analysis shows zero problem?
死锁的理解
STM32CubeMX configuration to generate FreeRTOS project
你真的懂Redis的5种基本数据结构吗?
自适应控制——仿真实验一 用李雅普诺夫稳定性理论设计自适应规律
[100 Solidity Skills] 1. Contract reentrancy attack
Online target drone prompt.ml
By building a sequence table - teach you to calculate time complexity and space complexity (including recursion)
Pytorch中 nn.Transformer的使用详解与Transformer的黑盒讲解
多线程保证单个线程开启事务并生效的方案
SST-Calib:结合语义和VO进行时空同步校准的lidar-visual外参标定方法(ITSC 2022)
Re20:读论文的先例:普通法的信息理论分析
OC-手动引用计数内存管理
这种叫什么手法