#Property 'PasswordCredential' does not exist on type 'Window & typeof globalThis'

6 messages · Page 1 of 1 (latest)

night flare
#

Is there something specific I need to configure to get types for 'PasswordCredential' ?

gritty sun
#

@night flare Looks like it's "experimental" so it's not included in the types built-into Typescript. When it stabilizes I'd expect it'd eventually be added.

#

In the mean time it looks like a fairly simple API to declare your own types for, I would maybe make a file like passwordCredential.d.ts and put it in your source directory, with content like:

declare class PasswordCredential {
    readonly iconUrl?: string;
    readonly name?: string;
    readonly password: string;

    constructor(
        options:
            | {
                  id: string;
                  password: string;
                  iconUrl?: string;
                  name?: string;
              }
            | HTMLFormElement,
    );
}
#

I'm guessing there'd also be other related APIs that may need to be declared, too.

#

You could also look maybe there's a community package that has these typings written already.

night flare
#

!resolved