Skip to content

서버에 있는 상태를 타이핑하는 것에 대한 고민 #150

Answered by milooy
nninnnin asked this question in Code Smell
Discussion options

You must be logged in to vote

오! 좋은 고민거리네요.

저라면 런타임에서 서버 응답을 검증하면서(zod든, 에러 throw든), 정적 타입을 활용하는 방식을 택할 것 같아요.
그리고 만약 스웨거에서 enum으로 제공해줄 수 있다면, OpenAPI Generator 등으로 서버 데이터를 기반으로 TypeScript 타입을 생성해주는 장치를 추가하면 서버와 프론트간의 싱크도 챙길 수 있어보입니다.

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@nninnnin
Comment options

Answer selected by nninnnin
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@nninnnin
Comment options

@nninnnin
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants