Module Augmentation1 Module Augmentation와 Interface Merge를 활용한 bottom - up 식 구현 모듈의 interface에 merge 함으로써 타입을 관리하면 더 강력한 추상화와 중앙집권식이 구조가 아닌 개별 관리 구조를 가져갈 수 있다. (bottom - top) remix.run 프레임워크를 사용한 예제이나, 해당 프레임워크를 몰라도 상관없습니다. app/service/api.ts export interface ApiFns {} export type ApiFnKeys = keyof ApiFns; export type ApiProps = { [key in ApiFnKeys]: Parameters[0]; }; export type Method = { method: M }; type ApiMethod = { [key in ApiFnKeys]: ApiFns[key]['method']; }; /* ..... 2022. 7. 24. 이전 1 다음