Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
Tags
- useref
- 에러
- redux
- Toolkit
- 상태변화감지
- 계층
- 프로그래머스
- 비선형 자료구조
- lv.0
- onAuthStateChanged
- LAN 과 WAN
- 닉네임보이게하기
- 9쪽이들
- typescript
- 뒤집기
- 프로세스
- 최종프로젝트
- DoM
- react
- CS
- router
- 쓰레드
- react-router-dom
- react-full-page
- 자바스크립트
- Firebase
- #kakaomap
- 심화프로젝트
- 배열
- S.A
Archives
- Today
- Total
행복한 딸기 🍓
[최종프로젝트] TailTales - typescript, react-full-page 적용 (2일차) 본문
트러블 슈팅
문제

typescript에 react-full-page이 지원이 안되는 것 같다.
yarn add react-full-page
다시 패키지를 설치해도 계속 모듈이 없다고 나왔다.
해결
자꾸 모듈이 없다고 떠서 모듈을 만들어야하는 건가? 라고 생각했다.
1. src 폴더 안에 index.d.ts라는 파일 생성을 해준다.
그 안에 코드를 추가해준다.
// index.d.ts
declare module "react-full-page" {
export interface ControlComponentsProps {
getCurrentSlideIndex: () => number;
onNext: () => void;
onPrev: () => void;
scrollToSlide: (n: number) => void;
slidesCount: number;
children: React.ReactNode;
}
export interface FullPageProps {
initialSlide?: number;
duration?: number;
controls?: boolean | React.FC<ControlComponentsProps>;
controlProps?: any;
beforeChange?: () => void;
afterChange?: () => void;
scrollMode?: "full-page" | "normal";
children: React.ReactNode;
}
export interface SlideProps {
children: React.ReactNode;
style?: { maxHeight: string };
}
export const FullPage: React.FC<FullPageProps>;
export const Slide: React.FC<SlideProps>;
}
2. tsconfig.json 파일에 안에 있는 "include" 안에 "node_modules/react-full-page"를 추가해준다.
"include": ["src", "node_modules/react-full-page"]
느낀 점
typescript는 type만 지정하면 된다고 생각했는데 모듈까지 만들어야한다는 것을 알게되었다.
typescript가 아직 익숙치 않아서 어렵게 느껴진다.
사용을 하면 배워 나가야겠다.
'TIL' 카테고리의 다른 글
| [Computer Science] CPU와 메모리의 역할은 무엇일까? (0) | 2023.08.21 |
|---|---|
| [최종프로젝트] TailTales - api 불러오기 (3일차) (0) | 2023.08.18 |
| [최종프로젝트] TailTales - S.A (1일차) (0) | 2023.08.16 |
| [심화프로젝트] 9쪽이들 kpt (1) | 2023.08.14 |
| [심화프로젝트] 9쪽이들 - 상세페이지 댓글 수정, 삭제 (4일차) (0) | 2023.08.10 |