question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support proposed ES Next "::" bind operator

See original GitHub issue

Edit from @DanielRosenwasser: Since this issue was filed, a separate proposal for :: was created called “extensions”.

https://github.com/tc39/proposal-extensions


It will be great if TypeScript had an implementation of the “::” bind operator of ECMAScript 7. Some examples of this operator and the implementation in ES5: Bind

// ES5
var log = console.log.bind(console);

// ES7
let log = ::console.log;

Call

// ES5
var forEach = Array.prototype.forEach,
    elements = document.querySelectorAll("div");

forEach.call(elements, div => { console.log(div); })

// ES7
let forEach = Array.prototype.forEach,
    elements = document.querySelectorAll("div");

elements::forEach(div => { console.log(div) });

[ref] [more examples]

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:360
  • Comments:77 (41 by maintainers)

github_iconTop GitHub Comments

28reactions
iglcommented, Apr 7, 2016
19reactions
bterlsoncommented, Sep 19, 2016

@mhegazy the story is even more complex - it’s possible “extension” classes (eg. a way to declaratively re-open another class inside a particular scope) would solve many of these use cases as well.

I wouldn’t say effort has stalled - I am still investigating and still want to see one or more of bind operator, bind syntax, pipeline operator, or extension classes in the language. But it will be some time before we get a good sense of the direction and so not implementing in TS for now seems like the best idea.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Function Bind Syntax - Babel.js
The function bind syntax introduces a new operator :: which performs function binding and method extraction.
Read more >
How to make VS Code recognize the ES7 bind operator
There are not yet plans to support it in JS or TS, only Babel does (experimentally). It is not ES7, and it is...
Read more >
TypeScript support for ES Next pipeline operator - Hacker News
Having .bind inside a JSX prop also creates a new anonymous function on each render. To avoid it, you can do (sorry for...
Read more >
Function.prototype.bind() - JavaScript - MDN Web Docs - Mozilla
The value is ignored if the bound function is constructed using the new operator. arg1, …, argN Optional. Arguments to prepend to arguments ......
Read more >
Taming this In JavaScript With Bind Operator
If you have any concerns, comments or desire to express your support, please go to the TC39 proposals repository, add a star to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found