문제 상황

React Native + TypeScript + Native Wind(TailwindCSS)를 사용해서 프로젝트를 하는 중 마주친 ts 에러!
No overload matches this call.
Overload 1 of 2, '(props: ViewProps): View', gave the following error.
Type '{ children: Element[]; className: string; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<View> & Readonly<ViewProps>'.
Property 'className' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<View> & Readonly<ViewProps>'.
Overload 2 of 2, '(props: ViewProps, context: any): View', gave the following error.
해결
프로젝트 루트 경로에 global.d.ts 파일을 만들고
/// <reference types="nativewind/types" />
를 써 넣어준다. /// 슬래시 세 개 까지 그대로!
출처
'Frontend > React' 카테고리의 다른 글
| 리액트로 소셜 로그인 구현하기(구글) (0) | 2024.05.16 |
|---|---|
| Mock Server를 활용한 슬기로운 프론트엔드 개발(MSW) (0) | 2024.04.12 |
| react-router-dom의 Link vs useNavigate() (1) | 2024.04.10 |
| 리액트+vite 프로젝트에서 번들 사이즈 줄이기 (0) | 2024.03.01 |
| [React] react-hook-form 과 zod로 리액트 form 리팩토링하기 (1) | 2024.02.13 |