0

I am trying to implement nativescript-oauth2 with IdentityServer 4 so I am trying to implement a custom provider but I am getting a compilation error as follows:

Property 'providerType' in type 'TnsOaProviderMyProvider' is not assignable to the same property in base type 'TnsOaProvider'. Type '"MyProvider"' is not assignable to type 'TnsOaProviderType'

import { TnsOaProvider, TnsOaProviderOptions, OpenIdSupportFull, TnsOaProviderType } from "nativescript-oauth2/providers/providers";
import { ITnsOAuthTokenResult } from "nativescript-oauth2";

export declare type ProviderTypeMyProvider = "MyProvider";
export interface TnsOaProviderOptionsMyProvider extends TnsOaProviderMyProvider {}

export declare class TnsOaProviderMyProvider implements TnsOaProvider {
    options: TnsOaProviderOptions;
    openIdSupport: OpenIdSupportFull;
    providerType: ProviderTypeMyProvider;
    authority: string;
    tokenEndpointBase: string;
    authorizeEndpoint: string;
    tokenEndpoint: string;
    cookieDomains: string[];
    constructor(options: TnsOaProviderOptionsMyProvider);
    parseTokenResult(jsonData: any): ITnsOAuthTokenResult;
}

Any idea how to extend the TnsOaProviderType which is defined as follows:

export type TnsOaProviderType =
  | ProviderTypeFacebook
  | ProviderTypeGoogle
  | ProviderTypeMicrosoft
  | ProviderTypeLinkedIn;
A_Nabelsi
  • 2,524
  • 18
  • 21
  • I think this question should be closed or deleted, the author of the library fixed the issue and changed the data type of the providerType property to string – A_Nabelsi Jan 23 '19 at 10:09

1 Answers1

0

There seems to be something wrong with your hierarchy.

You are extending TnsOaProviderOptionsMyProvider from TnsOaProviderMyProvider but you want to pass TnsOaProviderOptionsMyProvider as parameter to TnsOaProviderMyProvider itself?

Please double check if you have named them same by mistake.

Manoj
  • 21,753
  • 3
  • 20
  • 41