Reputation: 137
Using the following code as an example, which works perfectly, the typescript compiler is crying about the "import logo from './images/logo.svg';
" statement. The app works perfectly when ran in the browser so I am not having any issues with functionality. I'd just like to get rid of the squiggly red line so I can clean up my directory viewer. Any help would be greatly appreciated.
import * as React from 'react';
import logo from './images/logo.svg';
interface Property {}
interface State {}
export default class App extends React.Component<Property, State> {
render() {
return (
<div className="App">
<div className="App-header">
<img src={logo} className="App-logo" alt="logo" />
</div>
</div>
);
}
}
Upvotes: 6
Views: 3846
Reputation: 603
add declare module '*.svg' in any of your typing files. (.d.ts)
Upvotes: 3