got: Cannot find name 'URLSearchParams'

What would you like to discuss?

I’ve just upgraded to got@10 and got this TypeScript error:

tsc
node_modules/got/dist/source/utils/options-to-url.d.ts:12:71 - error TS2304: Cannot find name 'URLSearchParams'.

I figured it’s because in my tsconfig.json libs I don’t have dom. I’m consciously not using dom there to avoid importing/using Browser types that I never need in Node.js project (it caused me issues in the past, e.g global dom Request type clashes with Express.js Request type).

Is there a way to use got@10 in a TypeScript project without dom in libs?

Checklist

  • I have read the documentation.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

Let’s go with 2.