[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
- TypeScript 4.4 libdom changes
- Adding
skipLibCheck: true
totsconfig.json
prevents the transpilation errors.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks, @waterplea! I confirm that release
1.12.1
produces no errors withskipLibCheck: false
under TypeScript 4.4.4.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 toany
.