From 0beafec2fdde4903564a1635e443b5cff997825c Mon Sep 17 00:00:00 2001 From: Sadegh Date: Sat, 15 Aug 2026 08:14:18 -0400 Subject: [PATCH] Fix this-binding in getTA and getUser getTA and getUser reach sibling functions through this, which is only the module when called as a method (TradingView.searchMarketV3(...)). With a destructured import the receiver is lost, so in this sloppy-mode CommonJS module this becomes globalThis and it throws 'this.getTA is not a function'. tests/search.test.ts imports that way, so the TA tests fail on main. Resolve through module.exports, which doesn't depend on the call site. Same fix applied to getUser's redirect recursion. --- src/miscRequests.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/miscRequests.js b/src/miscRequests.js index a9707f2d..ba2dc556 100644 --- a/src/miscRequests.js +++ b/src/miscRequests.js @@ -120,7 +120,7 @@ module.exports = { symbol: s.symbol, description: s.description, type: s.type, - getTA: () => this.getTA(id), + getTA: () => module.exports.getTA(id), }; }); }, @@ -171,7 +171,7 @@ module.exports = { symbol: s.symbol, description: s.description, type: s.type, - getTA: () => this.getTA(id), + getTA: () => module.exports.getTA(id), }; }); }, @@ -465,7 +465,7 @@ module.exports = { } if (headers.location !== location) { - return this.getUser(session, signature, headers.location, redirectCount + 1); + return module.exports.getUser(session, signature, headers.location, redirectCount + 1); } throw new Error('Wrong or expired sessionid/signature');