惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Forbes - Security
Forbes - Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
L
LangChain Blog
量子位
GbyAI
GbyAI
B
Blog RSS Feed
月光博客
月光博客
人人都是产品经理
人人都是产品经理
腾讯CDC
Recent Announcements
Recent Announcements
Microsoft Azure Blog
Microsoft Azure Blog
I
InfoQ
The Cloudflare Blog
D
Docker
Cyberwarzone
Cyberwarzone
U
Unit 42
NISL@THU
NISL@THU
C
Check Point Blog
B
Blog
大猫的无限游戏
大猫的无限游戏
Cisco Talos Blog
Cisco Talos Blog
Recorded Future
Recorded Future
H
Hackread – Cybersecurity News, Data Breaches, AI and More
J
Java Code Geeks
G
GRAHAM CLULEY
Engineering at Meta
Engineering at Meta
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 叶小钗
P
Proofpoint News Feed
F
Fortinet All Blogs
V
V2EX
T
Threat Research - Cisco Blogs
T
Threatpost
S
SegmentFault 最新的问题
Know Your Adversary
Know Your Adversary
雷峰网
雷峰网
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
博客园 - 司徒正美
P
Privacy & Cybersecurity Law Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
TaoSecurity Blog
TaoSecurity Blog
Latest news
Latest news
Apple Machine Learning Research
Apple Machine Learning Research
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Y
Y Combinator Blog
P
Privacy International News Feed
L
Lohrmann on Cybersecurity
AWS News Blog
AWS News Blog
G
Google Developers Blog
美团技术团队

博客园 - Jiger

微软下一代Web前端技术Blazor(C#编译为WebAssembly) LinqPad的变量比较功能 Web后台技术趋势 MSBI - KPI 数据库的NULL值讨论 所有的列表都应该考虑排序 产品应该努力提高用户使用的方便性 上传和下载控制协议 CSV文件的规范 Silverlight商业应用实例-新浪财经银光版 前台线程和后台线程的区别 笔记:如何让wpf中disabled的控件弹出右键菜单 - Jiger - 博客园 xaml数据绑定时字段不存在的错误处理方法 jQuery中bind函数绑定多个事件 StringFormat绑定语法中的问题 wpf/silverlight指定空值特殊显示的语法 jQuery的ajax函数中timeout参数的默认值 Visual Studio中Website和Web Application Project的区别 Silverlight 2.0 学习笔记王计平版-01-开始学习XAML
TypeScript 编译目标(target)设置
Jiger · 2019-05-22 · via 博客园 - Jiger

TypeScript的编译配置文件tsconfig.json中有许多配置项,本文简单对比编译目标环境的配置项(target)的设置。模块(module)不在本文讨论之内,是另外一个大话题。

实验对于target 分别取值es5, es2015, es2016, es2017时,输出。

文件1:index.ts

async function helloWorld(): Promise<string> {
    const res = await fetch('/static/data.json');
    const txt = await res.text();
    return txt;
}
(async ()=>{
    const txt = await helloWorld()
    console.log(`async func: `, txt)
})()

执行tsc编译

tsc --target 'es3'    index.ts --outFile 'index.es3.js'    --lib 'es6','dom'
tsc --target 'es5'    index.ts --outFile 'index.es5.js'    --lib 'es6','dom'
tsc --target 'es6'    index.ts --outFile 'index.es6.js'
tsc --target 'es2017' index.ts --outFile 'index.es2017.js'

结果:

es3, es5 内容一样,有64行;

es6有19行;

es2017和原文一样(调整了空行,补充了分号)