rubenCodeforges / ng-gapi

ng-gapi a Google api module for Angular 6+

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Angular throws error when defining the 'prompt' property (but the application works)

edgargaza opened this issue · comments

Hey there!

I think I've found an issue while trying to open the google authorization window forcing always the account selection (prompt: "select_account" property). The showing error is the following:

ERROR in src/app/auth.ts(14,3): error TS2322: Type '{ client_id: string; discoveryDocs: string[]; prompt: string; scope: string; }' is not assignable to type 'NgGapiClientConfig'. Object literal may only specify known properties, and 'prompt' does not exist in type 'NgGapiClientConfig'.

However, the prompt property is working, because it opens the new window requesting to select the account before sign in. I've been testing with other properties, such as 'ux_mode', but I've found that it only throws the error only when using the 'prompt' property.

I am unsure why this could be happening, but if I edit the file named 'GoogleApiConfig.d.ts' from the 'ng-gapi' library, and add the 'prompt' property to the 'NgGapiClientConfig' interface, there's no error. The interface result is:

export interface NgGapiClientConfig extends ClientConfig {
    prompt: string; /* added property */
    discoveryDocs: string[];
}

Do you have any idea why this may be happening? Thanks!

Btw, sorry if there's any typo!

@edgargaza the promt property should be in ClinetConfig , we are extending from it.
Maybe the types didnt nor properly installed for you ?

Mmm how could I check it? I just installed ng-gapi with npm, is this correct or I would've to install other dependent packages manually? These days I've been using the API with no problems though, since I changed the interface class, but remember that before, the error was thrown but it worked perfectly anyway.

It should work , maybe try remove node modules and npm i again