Typescript styled-component error: “Type '{ children: string; }' has no properties in common with type 'IntrinsicAttributes'.”

后端 未结 3 925
轻奢々
轻奢々 2020-12-19 08:33

Getting a typescript error on my styled-component

Type \'{ children: string; }\' has no properties in common with type \'IntrinsicAttributes\'.ts(2559

3条回答
  •  不思量自难忘°
    2020-12-19 09:12

    Ok like it was stated above just to clarify if you create a component

       
    
            
    

    it automatically passes props to it and if when u declare it

    const DeliverNow = () => {}
    

    Typescript would tell you that they don't match cuz, in reality, DeliverNow takes in some props

    so in actual sense, its meant to be

    const DeliverNow = (props:any) => {}
    

提交回复
热议问题