You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I love tryit() dut don't understand why the functions that I pass sometimes need to be bound. For instance, the below code won't work without the .bind(em) part (findOne is from the mikro-orm package, this._em is an EntityManager object)
which causes a warning on the await on the next line (the await not being necessary because the following function does not return a promise).
Strangely, the code with the .bind() and the warning works fine while the code without gives a runtime error.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I love
tryit()dut don't understand why the functions that I pass sometimes need to be bound. For instance, the below code won't work without the.bind(em)part (findOneis from themikro-ormpackage,this._emis anEntityManagerobject)What's worse, adding the
.bind(em)turnsfindOnefrom typeinto type
which causes a warning on the
awaiton the next line (the await not being necessary because the following function does not return a promise).Strangely, the code with the
.bind()and the warning works fine while the code without gives a runtime error.Beta Was this translation helpful? Give feedback.
All reactions