inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

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

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

329

admin

작성한 질문수 7

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에 올라온 자료를 참고하면 해당 코드를 아래와 같이 풀어 가셨던데, 아래 코드로 작성해도 에러가 나서 문의 드립니다.

typescript 웹앱 nodejs

답변 1

0

제로초(조현영)

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

'S3' 형식에 'S3Client' 형식의 destroy, middlewareStack, send 속성이 없습니다.ts(2739)

0

505

1

throw new Error(`${this.name}.hasMany called with something that's not a subclass of Sequelize.Model`); 에러 질문

0

341

1

안녕하세요.. connect ECONNREFUSED 127.0.0.1:3306 관련해서 질문드립니다

0

955

1

@types를 dependencies에 넣는 이유?

0

398

1

JS에서 babel 사용시 `import * as` 구문을 안써도되는데, 바벨이 esModuleInterop: true 로 처리해주는 것인가요?

0

318

1

Sequelize Association 오류

0

501

2

Sequelize constructor.primaryKeyAttributes 오류

0

959

1

Sequelize에 요청을 보내면 오류가 뜹니다

0

793

1

강좌에서 사용된 3개의 코드 의미가 궁금합니다 [ 코드 : 1. [ key:string]:string] 2. delete user.password , 3.passport.deserializeUser<number> ]

0

337

1

@mui/x-data-grid 에 사용자정의 컬럼 타입을 추가해서 사용하려고 합니다.

0

2607

1

미들웨어 에러

1

312

1

Could not find a declaration file for mould '../utils/jwt-utils'

1

179

1

마지막에 type과 interface 추가하는 부분

0

217

1

다른 컴퓨터에서 제가 만든 DB 테이블의 데이터를 그대로 사용하려면?

0

282

1

express 모듈 에러 관련

0

235

1

import * as A from 'B'

0

212

1

MySql ssl 보안 옵션 질문 입니다.

0

351

2

passport/index.ts 에러 입니다

1

450

1

routes/post.ts 페이지에서 에러나요..

0

313

1

passport/index.ts 에러납니다...

0

816

1

ts import 에러

0

439

1

타입스크립트로 변환후 nextjs 빌드 후 배포

0

258

1

sequelize include 질문드립니다.!

0

186

1

roperty 'id' does not exist on type 'User'.

0

891

1