Declare two types in interface Attributes

196 views Asked by At

I need to declare both statements:

declare module "react" {
  interface Attributes {
    sx?: ThemeUIStyleObject;
  }
}

and

declare module "react" {
  interface Attributes {
    sx?: SxStyleProp;
  }
}

because if not, theme-ui errors appear in the sx prop.

I've tried this:

declare module "react" {
  interface Attributes {
    sx?: ThemeUIStyleObject | SxStyleProp;
  }
}

but only works the first Object (ThemeUIStyleObject)

1

There are 1 answers

0
Jisatsu On

Try & to join this two types.

sx?: ThemeUIStyleObject & SxStyleProp;