Skip to content

Commit

Permalink
Update react types to 19.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Mad-Kat committed Dec 29, 2024
1 parent 900c0e2 commit 181a565
Show file tree
Hide file tree
Showing 3 changed files with 282 additions and 288 deletions.
16 changes: 4 additions & 12 deletions packages/next-yak/runtime/styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ import type { YakTheme } from "./context/index.d.ts";
*/
const noTheme: YakTheme = {};

/**
* Minimal type for a function component that works with next-yak
*/
type FunctionComponent<T> = (
props: T,
context?: any,
) => React.ReactNode | React.ReactElement;

/**
* All valid html tags
*/
Expand Down Expand Up @@ -70,7 +62,7 @@ type Attrs<
// https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/constructors/styled.tsx
// https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/models/StyledComponent.ts
//
const StyledFactory = <T,>(Component: HtmlTags | FunctionComponent<T>) =>
const StyledFactory = <T,>(Component: HtmlTags | React.FunctionComponent<T>) =>
Object.assign(yakStyled(Component), {
attrs: <
TAttrsIn extends object = {},
Expand All @@ -89,13 +81,13 @@ type YakComponent<
T,
TAttrsIn extends object = {},
TAttrsOut extends AttrsMerged<T, TAttrsIn> = AttrsMerged<T, TAttrsIn>,
> = FunctionComponent<
> = React.FunctionComponent<
T & {
css?: StaticCSSProp;
}
> & {
[yakComponentSymbol]: [
FunctionComponent<T>,
React.FunctionComponent<T>,
AttrsFunction<T, TAttrsIn, TAttrsOut>,
];
};
Expand All @@ -106,7 +98,7 @@ const yakStyled = <
TAttrsOut extends AttrsMerged<T, TAttrsIn> = AttrsMerged<T, TAttrsIn>,
>(
Component:
| FunctionComponent<T>
| React.FunctionComponent<T>
| YakComponent<T, TAttrsIn, TAttrsOut>
| HtmlTags,
attrs?: Attrs<T, TAttrsIn, TAttrsOut>,
Expand Down
Loading

0 comments on commit 181a565

Please sign in to comment.