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

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - Jiger

微软下一代Web前端技术Blazor(C#编译为WebAssembly) LinqPad的变量比较功能 Web后台技术趋势 - Jiger MSBI - KPI 数据库的NULL值讨论 所有的列表都应该考虑排序 - Jiger 产品应该努力提高用户使用的方便性 上传和下载控制协议 - Jiger CSV文件的规范 Silverlight商业应用实例-新浪财经银光版 前台线程和后台线程的区别 笔记:如何让wpf中disabled的控件弹出右键菜单 - Jiger xaml数据绑定时字段不存在的错误处理方法 - Jiger jQuery中bind函数绑定多个事件 StringFormat绑定语法中的问题 - Jiger 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和原文一样(调整了空行,补充了分号)