question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] TypeScript error when importing framer-motion/three

See original GitHub issue

1. Read the FAQs 👇

2. Describe the bug

TypeScript error when importing framer-motion/three.

Cannot find module ‘framer-motion/three’ or its corresponding type declarations.

Framer motion works as expected with all animations. However, TypeScript is not happy with the import and does not have typechecking or autocomplete.

3. IMPORTANT: Provide a CodeSandbox reproduction of the bug

https://codesandbox.io/s/r3f-framer-motion-xx9kc?file=/src/App.tsx

4. Steps to reproduce

Steps to reproduce the behavior:

  1. Go to App.tsx file in Sandbox
  2. Go to the framer-motion/three import
  3. See the import error

5. Expected behavior

There is no error when importing framer-motion/three in TypeScript and the typechecking/autocomplete works for all framer-motion properties.

6. Video or screenshots

screenshot-2021-12-19-11 38 19@2x

7. Environment details

Version 5.4.5 of framer-motion.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:6
  • Comments:5

github_iconTop GitHub Comments

3reactions
mattgperrycommented, Jan 14, 2022

FYI next week we’re going to move this to its own framer-Motion-3d package which will fix this

2reactions
asyarbcommented, Jan 11, 2022

As a temporary workaround I’ve found that declaring “framer-motion/three” like below seems to work:

// framer-motion-three.d.ts
declare module "framer-motion/three" {
  export * from "framer-motion/types/three-entry"
}

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript import error with when importing a composed ...
I'm facing a weird import error when I try to import a redux compose component, I can't tell what's causing it, I've installed...
Read more >
Documentation - TypeScript 2.4
Dynamic import expressions are a new feature and part of ECMAScript that allows users to ... This can improve your experience and catch...
Read more >
TypeScript errors and how to fix them
This error occurs when you import the same file in two different files using two different casing styles (ex. camelCase and UpperCamelCase):. File...
Read more >
Announcing TypeScript 4.8 RC - Microsoft Developer Blogs
This behavior was incorrect, because named imports and exports for values that don't exist will cause a runtime error under ECMAScript modules.
Read more >
TypeScript support in Svelte - Learn web development
Early spotted bugs: The compiler checks types at compile time and provides error reporting. Readability: Static typing gives the code more ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found