Download

How To Resolve Type Errors With Static Assets

If your project directly imports static assets such as glb and gltf you'll also need to define that they're strings so the TypeScript compiler knows what they are.

Define them in a /types/assets.d.ts file:

declare module "*.glb" {
  const content: string;
  export default content;
}
 
declare module "*.gltf" {
  const content: string;
  export default content;
}

TypeScript now considers them to be strings when imported.

0