react-tsx

Typescript image import

坚强是说给别人听的谎言 提交于 2019-11-27 06:01:01
问题 I found a solution here: Webpack & Typescript image import But i am getting error for this: [ts] Types of property 'src' are incompatible. Type 'typeof import("*.png")' is not assignable to type 'string | undefined'. Type 'typeof import("*.png")' is not assignable to type 'string'. I guess i need to cast import somehow, but cant figure out how. I am doing this in React. I saw that src attribute is defined as string | undefined , that is why error is popping. Here is code: import * as Logo