• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    미해결

passport.ts 작성 시, serializeUser에서의 에러

21.04.20 11:06 작성 조회수 183

0

제목과 같이 serializeUser를 강의와 같이 작성시 아래와 같은 에러가 발생합니다. 

해당 에러를 해석 했을 때, serializeUser의 함수 정의는 Express.User로 되어 있는 것 같습니다.

No overload matches this call.
  Overload 1 of 2, '(fn: (user: User, done: (err: any, id?: unknown) => void) => void): void', gave the following error.
    Argument of type '(user: import("c:/Users/shinj/Desktop/nodebird/back/models/user").default, done: (err: any, id?: unknown) => void) => void' is not assignable to parameter of type '(user: Express.User, done: (err: any, id?: unknown) => void) => void'.
      Types of parameters 'user' and 'user' are incompatible.
        Type 'User' is missing the following properties from type 'User': id, nickname, userId, password, and 31 more.
  Overload 2 of 2, '(fn: (req: IncomingMessage, user: User, done: (err: any, id?: unknown) => void) => void): void', gave the following error.
    Argument of type '(user: User, done: (err: any, id?: unknown) => void) => void' is not assignable to parameter of type '(req: IncomingMessage, user: User, done: (err: any, id?: unknown) => void) => void'.
      Types of parameters 'user' and 'req' are incompatible.
        Type 'IncomingMessage' is missing the following properties from type 'User': id, nickname, userId, password, and 30 more.ts(2769)

강의 때 만든 models/user를 사용하기 위해서는 어떻게 해야하나요? github에 올라온 자료를 참고하면 해당 코드를 아래와 같이 풀어 가셨던데, 아래 코드로 작성해도 에러가 나서 문의 드립니다.

답변 1

답변을 작성해보세요.

0

강좌 공지사항(새소식) 확인해주세요~ 거기 최신버전에 따른 변경점 나와있습니다.