인프런 커뮤니티 질문&답변

낄낄이드래곤님의 프로필 이미지

작성한 질문수

Node.js에 TypeScript 적용하기(feat. NodeBird)

passport 설정하기

타입스크립트 에러

21.04.13 03:38 작성

·

230

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

제로초(조현영)님의 프로필 이미지
제로초(조현영)
지식공유자

2021. 04. 13. 11:21

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

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