I am facing an issue with using the Screen Wake Lock API in my Angular app. The code snippet I tried to use is:
if ('wakeLock' in navigator) {
await navigator.wakeLock.request();
}
However, when trying to compile my Angular app, I encountered the following error message:
Error: src/app/feature/test/test/test.component.ts:20:42 - error TS2339: Property 'wakeLock' does not exist on type 'Navigator'.
Here is some information about my Angular setup:
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 13.0.3
Node: 16.13.0
Package Manager: npm 8.1.0
OS: win32 x64
Angular: 13.0.2
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1300.3
@angular-devkit/build-angular 13.0.3
@angular-devkit/core 13.0.3
@angular-devkit/schematics 13.0.3
@angular/cdk 13.0.3
@angular/cli 13.0.3
@angular/flex-layout 13.0.0-beta.36
@angular/material 13.0.3
@schematics/angular 13.0.3
rxjs 6.6.7
typescript 4.4.4
I need assistance with fixing TypeScript so that it recognizes the Screen Wake Lock API and successfully compiles the code. Any help would be appreciated.