i m making an App with Angular 7 and i want to store the password of the users in the chrome built in a link! and i cant use it because cant create the " new PasswordCredential ".
i can check if it is availbe using '(window as any).PasswordCredential', but i cant create the instance of PasswordCredential
         if ((window as any).PasswordCredential) {
              const credentials = new PasswordCredential ({
                name: userLogin.username,
                password: userLogin.password,
              });
              return navigator.credentials.store(credentials);
            }
the error shows 'Cannot find name 'PasswordCredential'.ts(2304)'
and in the navigator also show 'Property 'credentials' does not exist on type 'Navigator'.ts(2339)'
First you need to write:
    declare global {
     interface Window {
      PasswordCredential: any;
      FederatedCredential: any;
     }
    }
Then:
if (window.PasswordCredential) {
      ...your code here
    }
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With