Skip to content

Add module import/export elision#565

Merged
Perryvw merged 4 commits intoTypeScriptToLua:masterfrom
ark120202:module-import-export-elision
May 22, 2019
Merged

Add module import/export elision#565
Perryvw merged 4 commits intoTypeScriptToLua:masterfrom
ark120202:module-import-export-elision

Conversation

@ark120202
Copy link
Copy Markdown
Contributor

@ark120202 ark120202 commented May 5, 2019

Resolves #178, resolves #494, fixes #555, closes #440.


private isModule = false;
// Resolver is lazy-initialized in transformSourceFile to avoid type-checking all files
private resolver!: EmitResolver;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Perryvw Perryvw merged commit 97fa41e into TypeScriptToLua:master May 22, 2019
@ark120202 ark120202 deleted the module-import-export-elision branch November 26, 2019 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

exported type Declaration files should not generate import statements Only generate import if import is used in value position

3 participants