From 8020f036d5830aa73256cf840dfeeef60a25ff42 Mon Sep 17 00:00:00 2001 From: Bobokhuja <65486207+Bobokhuja@users.noreply.github.com> Date: Mon, 11 Dec 2023 15:51:12 +0500 Subject: [PATCH] add type for margin prop --- packages/framer-motion/src/render/dom/viewport/index.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/framer-motion/src/render/dom/viewport/index.ts b/packages/framer-motion/src/render/dom/viewport/index.ts index 2813e9e99d..dfd62be8ce 100644 --- a/packages/framer-motion/src/render/dom/viewport/index.ts +++ b/packages/framer-motion/src/render/dom/viewport/index.ts @@ -3,9 +3,16 @@ import { resolveElements } from "../utils/resolve-element" export type ViewChangeHandler = (entry: IntersectionObserverEntry) => void +type MarginValue = `${number}${'px' | '%'}` +type MarginType = + MarginValue | + `${MarginValue} ${MarginValue}` | + `${MarginValue} ${MarginValue} ${MarginValue}` | + `${MarginValue} ${MarginValue} ${MarginValue} ${MarginValue}` + export interface InViewOptions { root?: Element | Document - margin?: string + margin?: MarginType amount?: "some" | "all" | number }