-
-
Notifications
You must be signed in to change notification settings - Fork 820
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] Compile error: Type 'undefined' is not assignable to type '(animation: AnimationPlaybackControls) => VoidFunction'.
#2861
Comments
I'm also facing this exact bug. Typescript 5.6.3. |
I'm dealing with this bug too. |
It's quite tough to fix this given Motion could have been built with different settings than the consuming code base. Is there a reason for disabling |
Proposed fix:motion/packages/framer-motion/src/animation/types.ts Lines 136 to 139 in 5053214
Change the above code to attachTimeline?: (
timeline: ProgressTimeline,
fallback: (animation: AnimationPlaybackControls) => VoidFunction
) => VoidFunction |
I'm not the OP, but the main reason I use "skiplibcheck: false" is primarily because new Vite apps start out configured this way, and because disabling it could hide bugs. I refer to this stack overflow question when deciding whether to enable the setting. I have a massive multimillion line app using framer motion (which I love, thanks for this tool ❤️). It is the only dependency causing a build error, and yes, other libraries just work. My current hack solution is to manually modify the node module dist index file with the change that @fxnm has proposed, but my build pipeline doesn't work smoothly without skipping the lib check. I hope the tiny fix can get merged into the main codebase soon. Thanks for everything. |
Thanks for the fix @fxnm - I'm not certain this is the fix I'll go with (just need to double check it) but its a good start. What I suppose I'm asking @geektechniquestudios is if there's something I can change in my own On the matter of whether |
to get the type erros, you need to set error log of: strict mode enabled in `framer-motion\tsconfig.json`
|
@mattgperry I understand this perspective, but consider that this flag isn't telling TypeScript to check the source of libraries, just the compiled and published One reason not to enable the flag is that when it's disabled, if TypeScript can't determine a type because of an issue in a dependency's type defs, it silently converts that type to I can definitely understand why some enable the flag, but I hope this helps explain why it's off by default and why you might choose to leave it off. Re your other question, other libraries do tend to work with the flag off. This issue is the first I've seen across our codebases' dependencies in a few years. |
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:
skipLibCheck
is set tofalse
npm run build
5. Expected behavior
The Application should build without errors.
But i got instead the following INTERNAL type error:
7. Environment details
Build fails on linux/windows using npm/pnpm/yarn
The text was updated successfully, but these errors were encountered: