Skip to content

Duplicate identifier URLSearchParams and URL in compiling got@10.0.2 with typescript@3.7.3 #980

@gvnn

Description

@gvnn

Describe the bug

  • Node.js version: v12.13.0
  • OS & version: MacOS 10.14.6

Error in compiling got@10.0.2 with typescript@3.7.3. Duplicate identifier 'URLSearchParams' and Duplicate identifier 'URL'. No issues with got@10.0.1 and typescript@3.7.2

Actual behavior

Below the errors that tsc compiler reports:

node_modules/got/dist/source/utils/types.d.ts:182:11 - error TS2300: Duplicate identifier 'URL'.

182     class URL {
              ~~~

  node_modules/typescript/lib/lib.dom.d.ts:16052:11
    16052 interface URL {
                    ~~~
    'URL' was also declared here.
  node_modules/typescript/lib/lib.dom.d.ts:16068:13
    16068 declare var URL: {
                      ~~~
    and here.

node_modules/got/dist/source/utils/types.d.ts:199:11 - error TS2300: Duplicate identifier 'URLSearchParams'.

199     class URLSearchParams implements Iterable<[string, string]> {
              ~~~~~~~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:16078:11
    16078 interface URLSearchParams {
                    ~~~~~~~~~~~~~~~
    'URLSearchParams' was also declared here.
  node_modules/typescript/lib/lib.dom.d.ts:16107:13
    16107 declare var URLSearchParams: {
                      ~~~~~~~~~~~~~~~
    and here.
  node_modules/typescript/lib/lib.dom.iterable.d.ts:263:11
    263 interface URLSearchParams {
                  ~~~~~~~~~~~~~~~
    and here.

node_modules/typescript/lib/lib.dom.d.ts:16052:11 - error TS2300: Duplicate identifier 'URL'.

16052 interface URL {
                ~~~

  node_modules/got/dist/source/utils/types.d.ts:182:11
    182     class URL {
                  ~~~
    'URL' was also declared here.

node_modules/typescript/lib/lib.dom.d.ts:16068:13 - error TS2300: Duplicate identifier 'URL'.

16068 declare var URL: {
                  ~~~

  node_modules/got/dist/source/utils/types.d.ts:182:11
    182     class URL {
                  ~~~
    'URL' was also declared here.

node_modules/typescript/lib/lib.dom.d.ts:16078:11 - error TS2300: Duplicate identifier 'URLSearchParams'.

16078 interface URLSearchParams {
                ~~~~~~~~~~~~~~~

  node_modules/got/dist/source/utils/types.d.ts:199:11
    199     class URLSearchParams implements Iterable<[string, string]> {
                  ~~~~~~~~~~~~~~~
    'URLSearchParams' was also declared here.

node_modules/typescript/lib/lib.dom.d.ts:16107:13 - error TS2300: Duplicate identifier 'URLSearchParams'.

16107 declare var URLSearchParams: {
                  ~~~~~~~~~~~~~~~

  node_modules/got/dist/source/utils/types.d.ts:199:11
    199     class URLSearchParams implements Iterable<[string, string]> {
                  ~~~~~~~~~~~~~~~
    'URLSearchParams' was also declared here.

node_modules/typescript/lib/lib.dom.iterable.d.ts:263:11 - error TS2300: Duplicate identifier 'URLSearchParams'.

263 interface URLSearchParams {
              ~~~~~~~~~~~~~~~

  node_modules/got/dist/source/utils/types.d.ts:199:11
    199     class URLSearchParams implements Iterable<[string, string]> {
                  ~~~~~~~~~~~~~~~
    'URLSearchParams' was also declared here.

Expected behavior

Compile with no errors.

Code to reproduce

package.json

{
  ...
  "scripts": {
    "build": "tsc",
  },
  "dependencies": {
    "got": "10.0.2"
  },
  "devDependencies": {
    "typescript": "3.7.3"
  }
  ...
}

index.ts

import got from "got";
console.log(got);

tsconfig.json
Standard config generated by npx tsc --init

Run npm run build to see errors.

Checklist

  • I have read the documentation.
  • I have tried my code with the latest version of Node.js and Got.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething does not work as it shouldtypesThe issue is related to TypeScript✭ help wanted ✭

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions