# openapi-typescript + react-query로 typesafe하게 rest api와 통신하기

> Clean Markdown view of GeekNews topic #5951. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=5951](https://news.hada.io/topic?id=5951)
- GeekNews Markdown: [https://news.hada.io/topic/5951.md](https://news.hada.io/topic/5951.md)
- Type: news
- Author: [seonghyeonkimmm](https://news.hada.io/@seonghyeonkimmm)
- Published: 2022-02-10T17:21:17+09:00
- Updated: 2022-02-10T17:21:17+09:00
- Original source: [gist.github.com/seonghyeonkimm](https://gist.github.com/seonghyeonkimm/977b58387f9f4e11afeee8c7685c2e89)
- Points: 6
- Comments: 0

## Topic Body

- 백엔드에서 제공하는 OpenApi Specs을 가지고 openapi-typescript를 활용하여 api의 parameters, response에 대한 type 생성

- ts-toolbelt에서 제공하는 type utils을 활용해서 필요한 유틸 type들 작성

- openapi-typescript에서 생성해준 typing과 ts-toolbelt로 만든 유틸 type을 활용하여 react-query의 useQuery를 wrapping하는 useOAIQuery를 만들어서 typesafe하고 조금 더 편한 서버통신을 가능하게 한 시도를 간단히 글로 정리함.

## Comments



_No public comments on this page._
