Skip to content

Commit 4af435e

Browse files
committed
simplify one thing
1 parent ee537c1 commit 4af435e

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

packages/react/types/jsx-namespace.d.ts

+9-19
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,28 @@ type WithConditionalCSSProp<P> = 'className' extends keyof P
88
: {}
99
: {}
1010

11-
// unpack all here to avoid infinite self-referencing when defining our own JSX namespace
12-
type ReactJSXElement = React.JSX.Element
13-
type ReactJSXElementClass = React.JSX.ElementClass
14-
type ReactJSXElementAttributesProperty = React.JSX.ElementAttributesProperty
15-
type ReactJSXElementChildrenAttribute = React.JSX.ElementChildrenAttribute
16-
type ReactJSXLibraryManagedAttributes<C, P> =
17-
React.JSX.LibraryManagedAttributes<C, P>
18-
type ReactJSXIntrinsicAttributes = React.JSX.IntrinsicAttributes
19-
type ReactJSXIntrinsicClassAttributes<T> = React.JSX.IntrinsicClassAttributes<T>
20-
type ReactJSXIntrinsicElements = React.JSX.IntrinsicElements
21-
2211
// based on the code from @types/[email protected]
2312
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/3197efc097d522c4bf02b94e1a0766d007d6cdeb/types/react/index.d.ts#LL3204C13-L3204C13
2413
type ReactJSXElementType = string | React.JSXElementConstructor<any>
2514

2615
export namespace EmotionJSX {
2716
type ElementType = ReactJSXElementType
28-
interface Element extends ReactJSXElement {}
29-
interface ElementClass extends ReactJSXElementClass {}
17+
interface Element extends React.JSX.Element {}
18+
interface ElementClass extends React.JSX.ElementClass {}
3019
interface ElementAttributesProperty
31-
extends ReactJSXElementAttributesProperty {}
32-
interface ElementChildrenAttribute extends ReactJSXElementChildrenAttribute {}
20+
extends React.JSX.ElementAttributesProperty {}
21+
interface ElementChildrenAttribute
22+
extends React.JSX.ElementChildrenAttribute {}
3323

3424
type LibraryManagedAttributes<C, P> = WithConditionalCSSProp<P> &
35-
ReactJSXLibraryManagedAttributes<C, P>
25+
React.JSX.LibraryManagedAttributes<C, P>
3626

37-
interface IntrinsicAttributes extends ReactJSXIntrinsicAttributes {}
27+
interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {}
3828
interface IntrinsicClassAttributes<T>
39-
extends ReactJSXIntrinsicClassAttributes<T> {}
29+
extends React.JSX.IntrinsicClassAttributes<T> {}
4030

4131
type IntrinsicElements = {
42-
[K in keyof ReactJSXIntrinsicElements]: ReactJSXIntrinsicElements[K] & {
32+
[K in keyof React.JSX.IntrinsicElements]: React.JSX.IntrinsicElements[K] & {
4333
css?: Interpolation<Theme>
4434
}
4535
}

0 commit comments

Comments
 (0)