-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: fixes r18 types * chore: changeset
- Loading branch information
Showing
2 changed files
with
9 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@compiled/react': patch | ||
--- | ||
|
||
Add `ElementType` to the Compiled JSX namespace. This is needed to ensure types are the same in the Compiled JSX namspace and the default React one, such as returning `undefined`, `string`, and other freshly valid types. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,9 @@ type WithConditionalCSSProp<TProps> = 'className' extends keyof TProps | |
{}; | ||
|
||
// Unpack all here to avoid infinite self-referencing when defining our own JSX namespace | ||
// Based on the code from @types/[email protected] / @emotion-js | ||
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/3197efc097d522c4bf02b94e1a0766d007d6cdeb/types/react/index.d.ts#LL3204C13-L3204C13 | ||
type ReactJSXElementType = string | React.JSXElementConstructor<any>; | ||
type ReactJSXElement = JSX.Element; | ||
type ReactJSXElementClass = JSX.ElementClass; | ||
type ReactJSXElementAttributesProperty = JSX.ElementAttributesProperty; | ||
|
@@ -59,6 +62,7 @@ type ReactJSXIntrinsicClassAttributes<T> = JSX.IntrinsicClassAttributes<T>; | |
type ReactJSXIntrinsicElements = JSX.IntrinsicElements; | ||
|
||
export namespace CompiledJSX { | ||
export type ElementType = ReactJSXElementType; | ||
export type Element = ReactJSXElement; | ||
export type ElementClass = ReactJSXElementClass; | ||
export type ElementAttributesProperty = ReactJSXElementAttributesProperty; | ||
|