Answers for "Cannot find module .svg' or its corresponding type declarations."

1

Cannot find module .svg' or its corresponding type declarations.

// Create a file named custom.d.ts with the following content:
declare module "*.svg" {
  const content: any;
  export default content;
}
// Add the custom.d.ts to tsconfig.json as below
"include": ["src/components", "src/custom.d.ts"]
Posted by: Guest on July-29-2021
2

Cannot find module '../../images/home.svg' or its corresponding type declarations

// custom.d.ts on root /

declare module '*.svg?inline' {
  const content: any
  export default content
}

declare module '*.svg' {
  const content: any
  export default content
}
Posted by: Guest on August-08-2020

Code answers related to "Cannot find module .svg' or its corresponding type declarations."

Code answers related to "TypeScript"

Browse Popular Code Answers by Language