样式组件中的打字稿(错误选择<DetailedHTMLProps <HTMLAttributes <HTMLDivElement>)

时间:2020-09-15 07:25:02

标签: css typescript styled-components

interface SomeDiv{
  width: number | string;
....
}

我正在尝试将带有样式组件的打字稿使用。


const SomeDiv = styled.div<SomeDiv>`
  height: 100%;
  min-width: 0;
  grid-column-end: ${({ width = 1 }): string => `span ${width}`};
  grid-row-end: ${({ height = 1 }): string => `span ${height}`};
  ${({ order }): string => order && `order: ${order}`}
  ${({ horizontal }): string => horizontal && `grid-column-start: ${horizontal}`}

我遇到此错误:

Property 'horizontal' does not exist on type
 'Pick<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 
"slot" | "style" | "title" | ... 251 more ... | "is"> & { ...; } & ThemeProps<...>'

0 个答案:

没有答案