Ts with Styled components

PHOTO EMBED

Thu Jan 27 2022 08:59:09 GMT+0000 (Coordinated Universal Time)

Saved by @avivdaniel #typescript

interface Props {
  isFixed?: boolean
}

interface Attrs {
  type?: string
}

const Button = styled.button.attrs(({ type = 'button' }: Attrs) => ({
  type,
}))`
  position: ${({ isFixed = false }: Props) => (isFixed ? 'fixed' : 'absolute')};
`

export default () => (
  <div>
    <Button isFixed={true} type="submit">
      I'm a button with type "submit" instead of default type of "button"
    </Button>
  </div>
)
content_copyCOPY

https://github.com/DefinitelyTyped/DefinitelyTyped/issues/28597