Skip to content

Type error with TypeScript 5.2.2 #26

Description

@GunnarSturla

First off, thanks for a fantastic package! Long time happy user, first time bug reporter here :)

Description

Updating TypeScript to 5.2.2 (possibly lower versions as well) causes/reveals a type error in the Box component. My guess would be that TS has changes how it resolves the generics, but to be honest, I don't fully understand how this package works.

Reproduction

Take the example Code Sandbox and update the TypeScript version to 5.2.2 in package.json (it might require reloading the tab)

Here's a link to an updated Sandbox showing the error

Expected behavior

Types should work

Actual behavior

Box component shows the following type error

Type '{ as: "h2"; style: { color: string | undefined; } & LibraryManagedAttributes<E, ComponentPropsWithRef<E>>[string]; } & Omit<...> & { ...; }' is not assignable to type 'IntrinsicAttributes & BoxOwnProps<"h2" & HeadingProps<E>["as"]> & Omit<LibraryManagedAttributes<"h2" & HeadingProps<E>["as"], ComponentPropsWithRef<...>>, "as">'.
  Type '{ as: "h2"; style: { color: string | undefined; } & LibraryManagedAttributes<E, ComponentPropsWithRef<E>>[string]; } & Omit<...> & { ...; }' is not assignable to type 'Omit<LibraryManagedAttributes<"h2" & HeadingProps<E>["as"], ComponentPropsWithRef<"h2" & HeadingProps<E>["as"]>>, "as">'.ts(2322)

Environment

All / Code Sandbox

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions