Add module import/export elision#565
Conversation
|
|
||
| private isModule = false; | ||
| // Resolver is lazy-initialized in transformSourceFile to avoid type-checking all files | ||
| private resolver!: EmitResolver; |
There was a problem hiding this comment.
It might be better to do this as an optional ? so it has to be verified before used, since it's set in a public api function (transformSourceFile) which could be overridden.
There was a problem hiding this comment.
It's true, but I think it complicates it's usage quite a lot with all these undefined checks. If it's not defined it would fail immediately anyway, just with a bit less clear error message.
Maybe we could have some different (internal?) method that would initialize state and then call transformSourceFile as a public visitor?
There was a problem hiding this comment.
Looking at this more, setupState couldn't be called if someone overrode transformSourceFile without calling the super version. So, I think you're suggestion here is probably necessary. Transformation should probably be kicked off by a non-override-able function.
Resolves #178, resolves #494, fixes #555, closes #440.