diff --git a/packages/@luke-ui/react/src/core/box/box.tsx b/packages/@luke-ui/react/src/core/box/box.tsx index e3249bb3..85131de6 100644 --- a/packages/@luke-ui/react/src/core/box/box.tsx +++ b/packages/@luke-ui/react/src/core/box/box.tsx @@ -68,25 +68,25 @@ export function omitUnsupportedSprinklesProps( props: Props, supportedProperties: ReadonlySet, ): Props { - const sprinklesProps = { ...props }; + const nextProps: Record = {}; - for (const key of Reflect.ownKeys(sprinklesProps)) { - if (sprinklesProperties.has(key) && !supportedProperties.has(key)) { - Reflect.deleteProperty(sprinklesProps, key); + for (const key of Reflect.ownKeys(props)) { + if (!sprinklesProperties.has(key) || supportedProperties.has(key)) { + nextProps[key] = props[key as keyof Props]; } } - return sprinklesProps; + return nextProps as Props; } function retainSprinklesProps(props: Props): Props { - const sprinklesProps = { ...props }; + const nextProps: Record = {}; - for (const key of Reflect.ownKeys(sprinklesProps)) { - if (!sprinklesProperties.has(key)) { - Reflect.deleteProperty(sprinklesProps, key); + for (const key of Reflect.ownKeys(props)) { + if (sprinklesProperties.has(key)) { + nextProps[key] = props[key as keyof Props]; } } - return sprinklesProps; + return nextProps as Props; }