URLSearchParams: has() with second argument
Unanswered
Stony gall posted this in #help-forum
Stony gallOP
I'm using the UrlSearchParams: has() method with the second argument value but when I build the Nextjs 13 latest app I get this error.
The app runs fine though, it seems the linter just complains but only during build. Is my tsconfig.js or eslint misconfigured somehow?
Expected 1 arguments, but got 2The app runs fine though, it seems the linter just complains but only during build. Is my tsconfig.js or eslint misconfigured somehow?
8 Replies
Toyger
second parameter only supported by firefox
Stony gallOP
Is there some sort of polyfill ?
@Stony gall Is there some sort of polyfill ?
Toyger
why polyfill
just use your function like that
it's basicaly one line
just use your function like that
it's basicaly one line
function checkSearchParams(urlSearchParams, key, value) {
return urlSearchParams.has(key) ? urlSearchParams.get(key) === value : false;
}Stony gallOP
@Toyger if I ignore the TS error the build succeeds and the app works using the second parameters - I believe Nextjs uses corejs polyfill https://github.com/zloirock/core-js#url-and-urlsearchparams - my question now is why I still get the error during build
I just read Nextjs replaces the
url package with the one from Nodejs https://nodejs.org/api/url.html#urlsearchparamshasname-value@Stony gall <@536484914221285376> if I ignore the TS error the build succeeds and the app works using the second parameters - I believe Nextjs uses corejs polyfill https://github.com/zloirock/core-js#url-and-urlsearchparams - my question now is why I still get the error during build
Toyger
I have no idea why it show error, if you checked that it works fine then you can ts-ignore it.