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

[BUG] framer-motion is incompatible with TypeScript v5.4 #2592

Closed
ska-kialo opened this issue Mar 25, 2024 · 1 comment · Fixed by #2587
Closed

[BUG] framer-motion is incompatible with TypeScript v5.4 #2592

ska-kialo opened this issue Mar 25, 2024 · 1 comment · Fixed by #2587
Labels
bug Something isn't working

Comments

@ska-kialo
Copy link

ska-kialo commented Mar 25, 2024

1. Read the FAQs 👇
Done, couldn't find anything related.

2. Describe the bug

Upgrading TypeScript to v5.4(.3) in our project produces a type error in framer-motion.

3. IMPORTANT: Provide a CodeSandbox reproduction of the bug

I couldn't figure out how to run type checking in CodeSandbox.
See steps below.

4. Steps to reproduce

Steps to reproduce on a repository that uses framer-motion:

  1. Install framer-motion v11.0.20 and TypeScript v5.4.3.
  2. Use the library in some way, e.g. const x: CSSStyleDeclarationWithTransform = {} as any;
  3. Run TypeScript.
  4. You see the following error, which seems to appear because lib.dom.d.ts now includes the properties x and y as string on CSSStyleDeclaration:
node_modules/framer-motion/dist/index.d.ts:1212:11 - error TS2430: Interface 'CSSStyleDeclarationWithTransform' incorrectly extends interface 'Omit<CSSStyleDeclaration, "direction" | "transition">'.
  Types of property 'x' are incompatible.
    Type 'string | number' is not assignable to type 'string'.
      Type 'number' is not assignable to type 'string'.

Steps to reproduce on this repository:

  1. Clone the framer motion repository.
  2. Upgrade TypeScript to 5.4.3 (e.g. using this patch, this requires ignoring some deprecations which is a separate issue).
  3. Run yarn build.
  4. You see the same error as mentioned above.

5. Expected behavior

No type errors are reported.

6. Video or screenshots

--

7. Environment details

Running on macOS on an M1 Mac. Can easily be reproduced on other systems.

@ska-kialo ska-kialo added the bug Something isn't working label Mar 25, 2024
@ska-kialo
Copy link
Author

ska-kialo commented Mar 25, 2024

Only now noticed #2587 which I think addresses this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant