• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    미해결

타입스크립트 에러

21.04.13 03:38 작성 조회수 159

1

models/user.ts 에서 User class 를 default export 하고

불러와서 타입에 할당했는데 다음과 같은 에러가 나타납니다.

혹시 이런에러가 나타났을때 해결을 어떻게해야할까요?

(alias) class User
import 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("/home/ywoosang/\uBC14\uD0D5\uD654\uBA74/projects/service/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, email, password, and 34 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, email, password, and 33 more.
ts(2769)

답변 1

답변을 작성해보세요.

0

새소식(공지사항) 참고해주세요.

https://www.inflearn.com/news/154101