Support proposed ES Next "::" bind operator
See original GitHub issueEdit 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:
- Created 8 years ago
- Reactions:360
- Comments:77 (41 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Nicer: https://github.com/mindeavor/es-pipeline-operator
@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.