我正在尝试使用IdentityServer 4实现nativescript-oauth2,所以我试图实现一个自定义提供程序,但是出现如下编译错误:
类型“ TnsOaProviderMyProvider”中的属性“ providerType”不是 可分配给基本类型为“ TnsOaProvider”的相同属性。类型 不能将““ MyProvider”'分配为'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;
}
任何想法如何扩展定义如下的TnsOaProviderType:
export type TnsOaProviderType =
| ProviderTypeFacebook
| ProviderTypeGoogle
| ProviderTypeMicrosoft
| ProviderTypeLinkedIn;
答案 0 :(得分:0)
您的层次结构似乎有问题。
您要从TnsOaProviderOptionsMyProvider
扩展TnsOaProviderMyProvider
,但想将TnsOaProviderOptionsMyProvider
作为参数传递给TnsOaProviderMyProvider
本身?
请仔细检查您是否错误地命名了它们。