question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] `network-information-types` conflicts with TypeScript 4.4 `libdom`

See original GitHub issue

🐞 Bug report

Description

Updating a project using @ng-web-apis/common from TypeScript 4.3 to 4.4 generates the following transpilation errors:

Error: node_modules/network-information-types/dist-types/index.d.ts:10:12 - error TS2687: All declarations of 'connection' must have identical modifiers.
10   readonly connection?: NetworkInformation;
              ~~~~~~~~~~

Error: node_modules/network-information-types/dist-types/index.d.ts:14:6 - error TS2300: Duplicate identifier 'ConnectionType'.
14 type ConnectionType =
        ~~~~~~~~~~~~~~
  node_modules/typescript/lib/lib.dom.d.ts:18813:6
    18813 type ConnectionType = "bluetooth" | "cellular" | "ethernet" | "mixed" | "none" | "other" | "unknown" | "wifi";
               ~~~~~~~~~~~~~~
    'ConnectionType' was also declared here.

Error: node_modules/network-information-types/dist-types/index.d.ts:36:12 - error TS2687: All declarations of 'type' must have identical modifiers.
36   readonly type?: ConnectionType;
              ~~~~

Error: node_modules/typescript/lib/lib.dom.d.ts:10461:14 - error TS2687: All declarations of 'connection' must have identical modifiers.
10461     readonly connection: NetworkInformation;
                   ~~~~~~~~~~

Error: node_modules/typescript/lib/lib.dom.d.ts:10482:14 - error TS2687: All declarations of 'type' must have identical modifiers.
10482     readonly type: ConnectionType;
                   ~~~~

Error: node_modules/typescript/lib/lib.dom.d.ts:18813:6 - error TS2300: Duplicate identifier 'ConnectionType'.
18813 type ConnectionType = "bluetooth" | "cellular" | "ethernet" | "mixed" | "none" | "other" | "unknown" | "wifi";
           ~~~~~~~~~~~~~~
  node_modules/network-information-types/dist-types/index.d.ts:14:6
    14 type ConnectionType =
            ~~~~~~~~~~~~~~
    'ConnectionType' was also declared here.

Expected behavior

Transpilation should occur without error.

Versions

  • OS: MacOS 11.5
  • Browser: N/A
  • Angular: 12.2.5
  • TypeScript: 4.4.2
  • ng-web-apis: 1.12.0

Additional context

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
KeithGillettecommented, Oct 15, 2021

Thanks, @waterplea! I confirm that release 1.12.1 produces no errors with skipLibCheck: false under TypeScript 4.4.4.

1reaction
waterpleacommented, Oct 15, 2021

I’ve made a PR for it. Since tokens are only type-checked when used with inject function and if you add them to constructor you type it yourself I think it should be fine to just rely on types being available at the project, falling back to any.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - TypeScript 3.9
The function's types declare that it takes two string s so that other TypeScript users can get type-checking errors, but it also does...
Read more >
Announcing TypeScript 4.5 - Microsoft Developer Blogs
Today we're excited to announce the release of TypeScript 4.5! If you're not yet familiar with TypeScript, it's a language that builds on ......
Read more >
Ng-Web-Apis Common Statistics & Issues - Codesti
[BUG] `network-information-types` conflicts with TypeScript 4.4 `libdom`, closed, 6, 2021-09-09, 2022-12-17, 2021-10-15. Request for mocks for unit-tests ...
Read more >
error TS2339: Property 'msSaveOrOpenBlob' does not exist on ...
@Heretic Monkey answer is correct, but if you just want to get around the issue - since you are using TypeScript - you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found