sucrase icon indicating copy to clipboard operation
sucrase copied to clipboard

Eventually is almost here: Class Fields

Open SMotaal opened this issue 6 years ago • 5 comments

https://github.com/alangpierce/sucrase/blob/15debf701596bd2a1d7564d8f1e147da357dfb56/src/transformers/RootTransformer.ts#L188-L191

Could we make those optional? There is partial implementation in V8 behind a flag.

Thanks 👍

SMotaal avatar Jul 20 '18 00:07 SMotaal

@SMotaal sure, seems reasonable. I'm hoping that at some point (maybe node 12), Sucrase can drop support for the class field transform as a breaking change, but seems reasonable to figure out the details now.

Out of curiosity, is there any problem with the current transform that you're running into, or is it just aesthetically nice to avoid transforms that aren't needed?

alangpierce avatar Jul 20 '18 16:07 alangpierce

It is definitely the second, I am almost always experimenting and transforms often make it more difficult to trace issues when they can be avoided. But this time, the transform actually overlaps directly with what I am testing (class fields).

Seeing that there are only a few (well orchestrated) transforms, it would be great if there was a way to opt out of any transform. I think that numeric-separators is around the corner, maybe not the night's party, but the principle holds imho.

SMotaal avatar Jul 20 '18 17:07 SMotaal

I have to say that I am very excited with the work you are doing, because I spent half of last year always reaching the conclusion that transpilers and transformers are very different things, aside from the tokenizer obviously. The next six months were all prototypes, many revelations and a lot learned, but obviously nothing as structured or close to being fully functional as what you have here. So 👍 👍 👍 for the outstanding work.

SMotaal avatar Jul 20 '18 17:07 SMotaal

Thanks! 😄

alangpierce avatar Jul 20 '18 17:07 alangpierce

Dropping these lines also worked for me. @alangpierce, would you be open to dropping this now since it's in engines?

pemrouz avatar Jan 25 '20 15:01 pemrouz