패키지를 import했는데
Cannot find module ' ' or its corresponding type declarations.
해결방법
GitHub - DefinitelyTyped/DefinitelyTyped: The repository for high quality TypeScript type definitions.
The repository for high quality TypeScript type definitions. - DefinitelyTyped/DefinitelyTyped
github.com
사이트에 들어가면 거의 모든 패키지를 타입정의를 해놓음
구글에
definitelyTyped '패키지명'
으로 검색해도 나옴
프로젝트에 설치 할 때는 터미널에
npm i -D @types/패키지명
하면됨
npm i -D @types//*packageName*/
ex) express 패키지 파일을 설치한다면
npm i -D @types/express
반응형
'Javascript > TypeScript' 카테고리의 다른 글
| [Typescript] js 소스코드를 typescript처럼 사용하기 (JSDOC) (0) | 2024.03.14 |
|---|---|
| [Typescript] ts파일에 Javascript 사용하기 (0) | 2024.03.14 |
| [TypeScript] 추상 메서드 vs 인터페이스 차이 (abstract vs interface) (0) | 2024.03.14 |
| [TypeScript] 속성값 제한하기 (0) | 2024.03.13 |
| [TypeScript] 제네릭(Generics) 사용하는 이유 (0) | 2024.03.13 |