import 'react' import { Interpolation } from '@emotion/serialize' import { Theme } from '@emotion/react' type WithConditionalCSSProp

= 'className' extends keyof P ? string extends P['className' & keyof P] ? { css?: Interpolation } : {} : {} // unpack all here to avoid infinite self-referencing when defining our own JSX namespace type ReactJSXElement = JSX.Element type ReactJSXElementClass = JSX.ElementClass type ReactJSXElementAttributesProperty = JSX.ElementAttributesProperty type ReactJSXElementChildrenAttribute = JSX.ElementChildrenAttribute type ReactJSXLibraryManagedAttributes = JSX.LibraryManagedAttributes type ReactJSXIntrinsicAttributes = JSX.IntrinsicAttributes type ReactJSXIntrinsicClassAttributes = JSX.IntrinsicClassAttributes type ReactJSXIntrinsicElements = JSX.IntrinsicElements // based on the code from @types/react@18.2.8 // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/3197efc097d522c4bf02b94e1a0766d007d6cdeb/types/react/index.d.ts#LL3204C13-L3204C13 type ReactJSXElementType = string | React.JSXElementConstructor export namespace EmotionJSX { type ElementType = ReactJSXElementType interface Element extends ReactJSXElement {} interface ElementClass extends ReactJSXElementClass {} interface ElementAttributesProperty extends ReactJSXElementAttributesProperty {} interface ElementChildrenAttribute extends ReactJSXElementChildrenAttribute {} type LibraryManagedAttributes = WithConditionalCSSProp

& ReactJSXLibraryManagedAttributes interface IntrinsicAttributes extends ReactJSXIntrinsicAttributes {} interface IntrinsicClassAttributes extends ReactJSXIntrinsicClassAttributes {} type IntrinsicElements = { [K in keyof ReactJSXIntrinsicElements]: ReactJSXIntrinsicElements[K] & { css?: Interpolation } } }