div 标签出现问题并在样式组件中键入任何内容(Gatsby 应用程序)

gee*_*ter 5 reactjs gatsby styled-components

我不知道该如何处理这个错误。东西仍然编译成功,但我的 div 内的内容仍然不会显示在浏览器中:

([ts] 类型 '(tag:any) => { (...args:any[]):any; withConfig(config:any): ...; attrs(attrs:任何):...;}'。[2339])

我在这里做错了什么?

 let iconNames = []
for (let index = 0; index < icons.length; index++) {
    iconNames.push(icons[index]["name"])
}
//align-items, for verticle
//justify-items, for horizontal
const Container = styled.div ` // <== error        is on this line here 
     height: 100%;
     display: grid;
     align-items: center; 
     justify-items: center; 
    `
// Define type of property
interface Props {
    name: string;
}
interface State {
    svg: any;
}
Run Code Online (Sandbox Code Playgroud)

aoh*_*aoh 4

通过安装这个问题就消失了@types/styled-components