Skip to content

Commit

Permalink
Replace JSX with React.JSX (#595)
Browse files Browse the repository at this point in the history
  • Loading branch information
memark authored Oct 7, 2024
1 parent 7f199d3 commit 393ecd5
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions goober.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ declare namespace goober {

interface StyledFunction {
// used when creating a styled component from a native HTML element
<T extends keyof JSX.IntrinsicElements, P extends Object = {}>(
<T extends keyof React.JSX.IntrinsicElements, P extends Object = {}>(
tag: T,
forwardRef?: ForwardRefFunction
): Tagged<
JSX.LibraryManagedAttributes<T, JSX.IntrinsicElements[T]> & P & Theme<DefaultTheme>
React.JSX.LibraryManagedAttributes<T, React.JSX.IntrinsicElements[T]> &
P &
Theme<DefaultTheme>
>;

// used to extend other styled components. Inherits props from the extended component
Expand All @@ -26,19 +28,22 @@ declare namespace goober {

// used when creating a component from a string (html native) but using a non HTML standard
// component, such as when you want to style web components
<P extends Object = {}>(tag: string): Tagged<P & Partial<JSX.ElementChildrenAttribute>>;
<P extends Object = {}>(tag: string): Tagged<
P & Partial<React.JSX.ElementChildrenAttribute>
>;

// used to create a styled component from a JSX element (both functional and class-based)
<T extends JSX.Element | JSX.ElementClass, P extends Object = {}>(
<T extends React.JSX.Element | React.JSX.ElementClass, P extends Object = {}>(
tag: T,
forwardRef?: ForwardRefFunction
): Tagged<P>;
}

// used when creating a styled component from a native HTML element with the babel-plugin-transform-goober parser
type BabelPluginTransformGooberStyledFunction = {
[T in keyof JSX.IntrinsicElements]: Tagged<
JSX.LibraryManagedAttributes<T, JSX.IntrinsicElements[T]> & Theme<DefaultTheme>
[T in keyof React.JSX.IntrinsicElements]: Tagged<
React.JSX.LibraryManagedAttributes<T, React.JSX.IntrinsicElements[T]> &
Theme<DefaultTheme>
>;
};

Expand Down

0 comments on commit 393ecd5

Please sign in to comment.