Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace JSX with React.JSX #595

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading