swc v1.2.11: Fix for almost all typescript bugs
#
Bugfixes#918)#
super statements (Thanks to @Brooooooklyn, no statement will be injected before super()
. The patch affects code like
by making the call to _definedProperty
generated because of public readonly message
to be injected after super(message);
.
#922)#
[key: string]: Type is stripped out properly (Previously, in the code below,
[key: string]: any;
was not stripped out properly. This is reported by the deno team, and the bug makes me look for a way to find typescript-related bugs, and as a result, [email protected]
is full of typescript related patches. I used tests from the official typescript repository to ensure generated ecmascript files are valid.
#924)#
binding identifier named await (I think this will not affect real-world codes, but it's fixed anyway.
was incorrectly parsed as
but it's now fixed.
#924)#
export declare class (Because declare
is typically used in .d.ts files, it will not affect many codes. Code like
should be compiled out, and it is, starting from [email protected]
.
#924)#
declare var (I expect this patch to affect some of codebases.
a
in the code above is now removed completely.
#924)#
conditional enum declarations in if (Just don't do this. Although swc
handles it, it's not the right thing to do.
#924)#
sequence expression in key (Again, don't do this. You can does not mean you should. Anyway, because swc
tries to follow the spec as much as possible, I added some code to handle the code below.
Note: The bug will not affect your code if you are targeting es3
or es5
.
#924)#
await in heritage clause (Accoarding to the ecmascript spec, the code below is valid.
Note: The bug will not affect your code if you are targeting es3
or es5
.
#924)#
optional array / object pattern (?
in the code below was problematic.
They should both be compiled as
but they were compiled as
respectively, and the typescript code handler is fixed. If you were using es3
or es5
as a target, the bug will not affect you.