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

Typing errors in Typescript 4.8+ #431

Open
mrazorvin opened this issue Dec 6, 2022 · 0 comments
Open

Typing errors in Typescript 4.8+ #431

mrazorvin opened this issue Dec 6, 2022 · 0 comments

Comments

@mrazorvin
Copy link

Hi,

In typescript 4.8+ generics no longer assignable to {}, those changes cause following error

image

to fix this, generics in styletron must extends {}

Index: ./node_modules/styletron-react/lib/types.d.ts
--- ./node_modules/styletron-react/lib/types.d.ts
+++ ./node_modules/styletron-react/lib/types.d.ts
@@ -67,7 +67,7 @@
     displayName?: string;
 }
 export declare type StyledFn = {
-    <T extends React.ElementType, Props>(component: T, style: StyleObject | ((props: Props) => StyleObject)): StyletronComponent<T, Props>;
+    <T extends React.ElementType, Props extends {}>(component: T, style: StyleObject | ((props: Props) => StyleObject)): StyletronComponent<T, Props>;
 };
 export declare type WithStyleFn = {
     <Base extends StyletronComponent<any, any>, Props = {}>(component: Base, style: StyleObject | ((props: Props) => StyleObject)): Base extends StyletronComponent<infer D, infer P> ? StyletronComponent<D, P & Props> : never;
@mrazorvin mrazorvin changed the title Typescript 4.8+ Typing errors in Typescript 4.8+ Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant