Repository navigation
typescript: a method passed by reference registers with the function that passes it - #1728
Merged
Merged
Conversation
…that passes it
`xs.forEach(this.handle, this)`, `el.addEventListener('click', this.onClick)` and
`setTimeout(this.onHover.bind(this))` hand an instance method over without calling it, and the
passer had no row for it, where a free function passed at the same position had one.
method_value reads the member off the receiver's type (or shape) the way an instance call does,
sees through `.bind`, and leaves getters, setters, data fields and `.call`/`.apply` alone.
Co-authored-by: axiomcode-bot[bot] <334110751+axiomcode-bot[bot]@users.noreply.github.com>
swapnilpaliwal-sd
requested review from
JaredHLZhang,
Whua689 and
suyashpaliwal26
as code owners
September 29, 2026 00:48
…ler reports Co-authored-by: axiomcode-bot[bot] <334110751+axiomcode-bot[bot]@users.noreply.github.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A TypeScript instance method handed over without being called (
this.m,this.m.bind(this),xs.forEach(this.m, this),el.addEventListener('x', this.m)) had no row from the function that passes it. A free function at the same position already got one.method_valueinvalue-flow.dllooks the member up on the receiver's type or shape, the same way an instance call does, and sees through.bind. It feedshanded_function(thecallback_registeredrows) andholder_holds_function..call/.apply, a data field, and a getter (read at that point). New golden case80-method-passed-by-reference.const b = f.bind(null); b()now reachesf).