-
Notifications
You must be signed in to change notification settings - Fork 786
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1833 from framer/fix/event-type
Fixing event type inference for `useMotionValueEvent`
- Loading branch information
Showing
3 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
packages/framer-motion/src/utils/__tests__/use-motion-value-event.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import * as React from "react" | ||
import { render } from "../../../jest.setup" | ||
import { useMotionValue } from "../../value/use-motion-value" | ||
import { useMotionValueEvent } from "../use-motion-value-event" | ||
|
||
describe("useMotionValueEvent", () => { | ||
test("useMotionValueEvent infers type for change callback", () => { | ||
const Component = () => { | ||
const x = useMotionValue(0) | ||
useMotionValueEvent(x, "change", (latest) => latest / 2) | ||
return null | ||
} | ||
|
||
render(<Component />) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters