typescript error - Cannot find module '<image>' or its corresponding type declarations.ts(2307)

pyk0844·2023년 1월 30일
0

리액트 프로젝트에서 이미지 첨부를 하려고 하니 타입스크립트 에러가 났다...

src 경로에 있는 'custom.d.ts' 파일을 수정하니 해결 되었다.

  // 이렇게 추가
  declare module "*.jpg";
  declare module "*.png";

--> (해당 경로에 .d.ts 파일 없을 경우 만들어주면 됌)

참고
Using images in React and TypeScript with Webpack 5
Add images to a React project with Typescript

0개의 댓글