Open smilejakdu opened 3 years ago
안에
interface Authenticator<InitializeRet = express.Handler, AuthenticateRet = any, AuthorizeRet = AuthenticateRet, AuthorizeOptions = AuthenticateOptions> {
use(strategy: Strategy): this;
use(name: string, strategy: Strategy): this;
unuse(name: string): this;
framework<X, Y, Z>(fw: Framework<X, Y, Z>): Authenticator<X, Y, Z>;
initialize(options?: { userProperty: string; }): InitializeRet;
session(options?: { pauseStream: boolean; }): AuthenticateRet;
authenticate(strategy: string | string[] | Strategy, callback?: (...args: any[]) => any): AuthenticateRet;
authenticate(strategy: string | string[] | Strategy, options: AuthenticateOptions, callback?: (...args: any[]) => any): AuthenticateRet;
authorize(strategy: string | string[], callback?: (...args: any[]) => any): AuthorizeRet;
authorize(strategy: string | string[], options: AuthorizeOptions, callback?: (...args: any[]) => any): AuthorizeRet;
serializeUser<TUser, TID>(fn: (user: TUser, done: (err: any, id?: TID) => void) => void): void;
serializeUser<TUser, TID, TR extends IncomingMessage = express.Request>(fn: (req: TR, user: TUser, done: (err: any, id?: TID) => void) => void): void;
deserializeUser<TUser, TID>(fn: (id: TID, done: (err: any, user?: TUser) => void) => void): void;
deserializeUser<TUser, TID, TR extends IncomingMessage = express.Request>(fn: (req: TR, id: TID, done: (err: any, user?: TUser) => void) => void): void;
transformAuthInfo(fn: (info: any, done: (err: any, info: any) => void) => void): void;
}
중에서
serializeUser<TUser, TID>(fn: (user: TUser, done: (err: any, id?: TID) => void) => void): void;
serializeUser<TUser, TID, TR extends IncomingMessage = express.Request>(fn: (req: TR, user: TUser, done: (err: any, id?: TID) => void) => void): void;
deserializeUser<TUser, TID>(fn: (id: TID, done: (err: any, user?: TUser) => void) => void): void;
deserializeUser<TUser, TID, TR extends IncomingMessage = express.Request>(fn: (req: TR, id: TID, done: (err: any, user?: TUser) => void) => void): void;
이부분이 잘되어있는지 확인해 본다. 아마도 제네릭 부분에 타입이 하나밖에 없는지 확인을 우선적으로 해본다.
ex)
serializeUser<TID>(fn: (user: Express.User, done: (err: any, id?: TID) => void) => void): void;
serializeUser<TID, TR extends IncomingMessage = express.Request>(fn: (req: TR, user: Express.User, done: (err: any, id?: TID) => void) => void): void;
deserializeUser<TID>(fn: (id: TID, done: (err: any, user?: Express.User | false | null) => void) => void): void;
deserializeUser<TID, TR extends IncomingMessage = express.Request>(fn: (req: TR, id: TID, done: (err: any, user?: Express.User | false | null) => void) => void): void;
이렇게 되어있다면
serializeUser<TUser, TID>(fn: (user: TUser, done: (err: any, id?: TID) => void) => void): void;
serializeUser<TUser, TID, TR extends IncomingMessage = express.Request>(fn: (req: TR, user: TUser, done: (err: any, id?: TID) => void) => void): void;
deserializeUser<TUser, TID>(fn: (id: TID, done: (err: any, user?: TUser) => void) => void): void;
deserializeUser<TUser, TID, TR extends IncomingMessage = express.Request>(fn: (req: TR, id: TID, done: (err: any, user?: TUser) => void) => void): void;
이렇게 바꿔준다.
passport index error
number : Type 'number' does not satisfy the constraint 'IncomingMessage'. id : Property 'id' does not exist on type 'User'