강의

멘토링

커뮤니티

Inflearn Community Q&A

hs6383's profile image
hs6383

asked

Applying TypeScript to Node.js (feat. NodeBird)

Create user and post routers

질문드립니다.

Written on

·

280

0

router.get<{}, {}, {}, { offset: string, limit: string }>('/:id....)

<{}, {}, {}, { offset: string, limit: string }> 이게 무슨뜻인가요?

nodejstypescript웹앱

Answer 2

0

hs6383님의 프로필 이미지
hs6383
Questioner

감사합니다!

0

zerocho님의 프로필 이미지
zerocho
Instructor

원래 타입은 다음과 같습니다.

P = RouteParameters<Route>,
ResBody = any,
ReqBody = any,
ReqQuery = ParsedQs,

4번째 자리는 ReqQuery자리로 req.query를 타이핑합니다.

1번째는 req.params, 2번째는 res.body, 3번째는 req.body 자리입니다.

hs6383's profile image
hs6383

asked

Ask a question