@radix-ui/themes
Version:
[](https://radix-ui.com/themes)
13 lines (10 loc) • 412 B
text/typescript
import { breakpoints } from '../props/prop-def.js';
import type { Responsive, Breakpoint } from '../props/prop-def.js';
export function isResponsiveObject<Value extends string>(
obj: Responsive<Value | Omit<string, Value>> | undefined
): obj is Record<Breakpoint, string> {
return (
typeof obj === 'object' &&
Object.keys(obj).some((key) => (breakpoints as readonly string[]).includes(key))
);
}