Skip to content

Bind logger function before using #17983

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 23, 2017
Merged

Bind logger function before using #17983

merged 2 commits into from
Aug 23, 2017

Conversation

mhegazy
Copy link
Contributor

@mhegazy mhegazy commented Aug 23, 2017

bind log function to avoid invalid access to this.

@@ -149,7 +149,7 @@ namespace ts.server.typingsInstaller {
}
const discoverTypingsResult = JsTyping.discoverTypings(
this.installTypingHost,
this.log.isEnabled() ? this.log.writeLine : undefined,
this.log.isEnabled() ? this.log.writeLine.bind(this.log) : undefined,
Copy link
Member

Choose a reason for hiding this comment

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

Use line => this.log.writeLine(line) instead of .bind? AFAIK we'd avoided using bind in most places, why stop now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we avoided bind.. why.

@weswigham
Copy link
Member

Does this need to be PR'd into master, too?

@mhegazy mhegazy merged commit 1420fbc into release-2.5 Aug 23, 2017
@mhegazy mhegazy deleted the bindLogFunction branch August 23, 2017 19:35
mhegazy added a commit that referenced this pull request Aug 23, 2017
* Bind logger function before using

* Use lambda isntead of bind
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants