Skip to content

Commit

Permalink
Add typeof check for strings and remove ts-expect-error
Browse files Browse the repository at this point in the history
  • Loading branch information
dopenguin committed Feb 25, 2025
1 parent ab3663a commit 26d14e2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/core/src/utils/createMap/addInterceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ export function addInterceptor(interceptorUrlRegex: string) {
window.fetch = (resource, originalConfig) => {
let config = originalConfig

// @ts-expect-error | Has worked like charm so far. If an error occurs if resource is of type RequestInfo, take another look
if (interceptorUrlRegex && resource?.match(interceptorUrlRegex)) {
if (
interceptorUrlRegex &&
typeof resource === 'string' &&
resource?.match(interceptorUrlRegex)
) {
config = {
...originalConfig,
// eslint-disable-next-line @typescript-eslint/naming-convention
Expand Down

0 comments on commit 26d14e2

Please sign in to comment.