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.

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:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
JoostKcommented, Jun 13, 2020

Thanks. The reason the @types/w3c-web-usb package is not automatically included is because src/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 in tsconfig.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.

0reactions
angular-automatic-lock-bot[bot]commented, Jul 2, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

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