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

v11.13.3 type error with Next #3245

Open
Hyodori04 opened this issue Aug 22, 2024 · 5 comments
Open

v11.13.3 type error with Next #3245

Hyodori04 opened this issue Aug 22, 2024 · 5 comments

Comments

@Hyodori04
Copy link

Current behavior:

type Error Occurs after v11.13.3

const withAuth = <P extends object>(WrappedComponent: NextPage<P>) => {
  const AuthComponent = (props: P) => {
    ...my logic
    return <WrappedComponent {...props} />;
  }
}

Expected behavior:

Type Error is fixed , if it's not error. is there any method to solve this type error?

Environment information:

  • react version: 18.3.1
  • @emotion/react version: 11.13.3
@giggo1604
Copy link

giggo1604 commented Aug 26, 2024

I can confirm that v11.13.3 breaks this previously working pattern.

function render<P>(Component: React.ComponentType<P>, props: P) {
    return <Component {...props} />
}

@ENvironmentSet
Copy link
Contributor

It seems that typescript has complicates while comparing generic types fed with type variables. For those who need quick patch, I left a rough solution here. Check this out and use wisely.

/* Patch LibraryManagedAttributes type in jsx-namespace.d.ts (which can be found in node_modules/@ emotion/react/types) */

type LibraryManagedAttributes<C, P> =
  ((P extends unknown ? WithConditionalCSSProp<P> : {}) | {})
  & ReactJSXLibraryManagedAttributes<C, P>

I'll do more research on this and will come back with well organized patch maybe in this weekend. However, If there is someone interested and has some time to work on this, I wouldn't mind someone else do the fix instead of me.

@alhabibhasan
Copy link

Have come across this bug as well. Would be great to have a fix

@doubleniki
Copy link

Hi, is there any progress regarding this issue?

@shubham-vunet
Copy link

👍👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants