Skip to content

Commit

Permalink
toString for patched methods returns original toString
Browse files Browse the repository at this point in the history
  • Loading branch information
mdellanoce authored and colingm committed May 1, 2024
1 parent f1e6a51 commit 08c242b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/rrweb/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ export function patch(
// Make sure it's a function first, as we need to attach an empty prototype for `defineProperties` to work
// otherwise it'll throw "TypeError: Object.defineProperties called on non-object"
if (typeof wrapped === 'function') {
wrapped.toString = function () {
return original.toString();
};
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
wrapped.prototype = wrapped.prototype || {};
Object.defineProperties(wrapped, {
Expand Down

0 comments on commit 08c242b

Please sign in to comment.