Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
FrederikBolding committed Nov 19, 2024
1 parent c77adcd commit 89024f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,8 @@ describe('endowments', () => {
new ResponseWrapper(
new Response(),
{ lastTeardown: 0 },
// eslint-disable-next-line @typescript-eslint/no-empty-function
async () => {},
// eslint-disable-next-line @typescript-eslint/no-empty-function
async () => {},
async () => undefined,
async () => undefined,
),
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,11 @@ export class ResponseWrapper implements Response {
}
}

// We redefine the global Response class to overwrite [Symbol.hasInstance].
// This fixes problems where the response from `fetch` would not pass
// instance of checks, leading to failures in WASM bindgen.
class AlteredResponse extends Response {
static [Symbol.hasInstance](instance: any) {
static [Symbol.hasInstance](instance: unknown) {
return instance instanceof Response || instance instanceof ResponseWrapper;
}
}
Expand Down

0 comments on commit 89024f6

Please sign in to comment.