Skip to content

Import hoisting#526

Merged
tomblind merged 4 commits intomasterfrom
import-hoisting
Apr 17, 2019
Merged

Import hoisting#526
tomblind merged 4 commits intomasterfrom
import-hoisting

Conversation

@tomblind
Copy link
Copy Markdown
Collaborator

Fixes #525


const scope = this.peekScope();
if (!this.options.noHoisting && !scope.importStatements) {
scope.importStatements = [];
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.

I'm a little confused why this is not a strict violation, since peeking a scope could be undefined?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's because of microsoft/TypeScript#13778, but it's possible to change peekScope return type to Scope | undefined.

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.

Aha, we probably should make that change. Doesn't have to be in this PR though.

@tomblind tomblind merged commit 043b87d into master Apr 17, 2019
@tomblind tomblind deleted the import-hoisting branch April 17, 2019 14:42
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.

Import statements should be hoisted

3 participants