Skip to content

Assume files with imports to be modules#776

Merged
Perryvw merged 1 commit intoTypeScriptToLua:masterfrom
ark120202:imports-modules
Dec 26, 2019
Merged

Assume files with imports to be modules#776
Perryvw merged 1 commit intoTypeScriptToLua:masterfrom
ark120202:imports-modules

Conversation

@ark120202
Copy link
Copy Markdown
Contributor

Closes #564.

Now it matches TypeScript's logic, making files with imports or exports modules. It still keeps files without any imports or exports global, so probably shouldn't break too much things, because TypeScript already issued an unused variable diagnostic in these cases.

public readonly options: CompilerOptions = this.program.getCompilerOptions();
public readonly luaTarget = this.options.luaTarget ?? LuaTarget.LuaJIT;
public readonly isModule = isFileModule(this.sourceFile);
public readonly isModule = ts.isExternalModule(this.sourceFile);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What if all imports are elided is a file still considered a module in that case?

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.

Yes

@Perryvw Perryvw merged commit 0284f91 into TypeScriptToLua:master Dec 26, 2019
@ark120202 ark120202 deleted the imports-modules branch December 27, 2019 02:16
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.

Consider all files as modules

3 participants