Skip to content

[BUG] Compile error: Type 'undefined' is not assignable to type '(animation: AnimationPlaybackControls) => VoidFunction'. #2861

Closed
@fxnm

Description

@fxnm

1. Read the FAQs 👇

2. Describe the bug

When trying to build a project that uses framer-motion and "skipLibCheck": false the build fails.
If version is greater or equals to v11.9.0

3. IMPORTANT: Provide a CodeSandbox reproduction of the bug

https://codesandbox.io/p/devbox/jolly-mountain-66wd57

4. Steps to reproduce

Steps to reproduce the behavior:

  1. Create a react 18 project with vite, typescript and framer-motion
  2. Make sure that skipLibCheck is set to false
  3. Add a component to the app, so the lib gets compiled
  4. Run npm run build

5. Expected behavior

The Application should build without errors.
But i got instead the following INTERNAL type error:

node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/framer-motion/dist/index.d.ts:3824:5 - error TS2416: Property 'attachTimeline' in type 'GroupPlaybackControls' is not assignable to the same property in base type 'AnimationPlaybackControls'.
  Type '(timeline: any, fallback: (animation: AnimationPlaybackControls) => VoidFunction) => () => void' is not assignable to type '(timeline: ProgressTimeline, fallback?: ((animation: AnimationPlaybackControls) => VoidFunction) | undefined) => VoidFunction'.
    Types of parameters 'fallback' and 'fallback' are incompatible.
      Type '((animation: AnimationPlaybackControls) => VoidFunction) | undefined' is not assignable to type '(animation: AnimationPlaybackControls) => VoidFunction'.
        Type 'undefined' is not assignable to type '(animation: AnimationPlaybackControls) => VoidFunction'.

3824     attachTimeline(timeline: any, fallback: (animation: AnimationPlaybackControls) => VoidFunction): () => void;
         ~~~~~~~~~~~~~~


Found 1 error in node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/framer-motion/dist/index.d.ts:3824

7. Environment details

Build fails on linux/windows using npm/pnpm/yarn

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions