Chrome specific runtime variables throw error - @types/w3c-web-usb
See original GitHub issue🐞 bug report
Is this a regression?
Seems to be an ongoing issue: https://github.com/angular/angular/issues/4902
Description
navigator.usb.requestDevice({
filters: [{}]
});
Will work but it throws the following error:
Property ‘usb’ does not exist on type ‘Navigator’.
and if you use more of the w3c-web-usb types
Cannot find name ‘USBDevice’.
🔬 Minimal Reproduction
https://github.com/noelelias/angular-usb-issue
🔥 Exception or Error
Property ‘usb’ does not exist on type ‘Navigator’.
🌍 Your Environment
Angular CLI version 9.1.6 Angular: 9.1.11
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
How to throw a javascript error during runtime via browser ...
Open the webpage · Open Chrome developer tools for that webpage · In Sources panel go to Overrides tab · Click Select folder...
Read more >Using Environment Variables | Cloud Functions Documentation
Runtime environment variables are key/value pairs deployed alongside a function. These variables are scoped to the function and are not visible to other ......
Read more >Supported directory variables - Chrome Enterprise and ...
This helps to avoid errors caused by applications starting in different locations on different occasions. Each variable can occur only once in a...
Read more >Failed to assume control of Chrome at "Launch New Chrome ...
In case the below errors are thrown at the "Launch New Chrome" action: ... we need to check the machine's "ComSpec" "Environment Variable"....
Read more >View the list of all variables in Google Chrome Console using ...
keys() method is used to return the properties of the given object as an array. As the window object represents the current browser's...
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. The reason the
@types/w3c-web-usb
package is not automatically included is becausesrc/tsconfig.app.json
specifies"types": []
, I’m guessing because it excludes testing related types from being visible in production code. Because of this configuration, TS will not automatically include any types in./node_modules/@types/
. If you add"w3c-web-usb"
to that array (also intsconfig.spec.ts
) it will start to work.The is a bit about typings in https://angular.io/guide/typescript-configuration however the scenario where global ambient files are used is not documented there. So from that perspective the docs could be extended to mention this case.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.