Skip to content

TS开发下,ES6语法都支持? #60

@alanhe421

Description

@alanhe421

TS号称是JS的超集,TS解决的问题即是它的定位,类型。所以可以在开发解决避免特别多的问题。
TS中实际上只要能够写出来,其实都是支持的。

比如这里,我使用ES6下的扩展运算符

const testArr = [1, 2, 3];
console.log(...testArr);

我们这里设定编译后的目标版本为es5
进行编译,通过源码我们会看到实际上,编译器帮我改写为ES5的写法了。

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions