Changelog: swc v1.1.53


Parser improvements (#816)#

swc had a bug related to parsing of type annotations. This is fixed by the pr and swc can really parse almost all typescript codes.

class member named declare (#822)#

The code below is quite simple, but need some careful approach to parse it correctly, as declare is one of contextual keywords.

class A {
declare() {}

swc can now parse class memebers named declare.

Typescript enums (#821)#

swc miscompiled typescript enums if an enum member references other variant.

Affected code looks like

enum Direction {
Up = 1,
Down = 2,
Left = Up + Down,

and it's now compiled as

var Direction;
(function (Direction) {
Direction[Direction['Up'] = 1] = 'Up';
Direction[Direction['Down'] = 2] = 'Down';
Direction[Direction['Left'] = 3] = 'Left';
})(Direction || (Direction = {}));"

which is exactly same as it of tsc.