shorted-theme
Version:
Shorted theme references for Styled Components.
12 lines (11 loc) • 624 B
TypeScript
import { ThemeProps, DefaultTheme } from 'styled-components';
declare type Functionified<Theme, Target> = {
[key in keyof Target]: Target[key] extends Record<string, unknown> ? Functionified<Theme, Target[key]> : (props: ThemeProps<Theme>) => Target[key];
};
/**
* Convert all properties in a object to interpolated theme functions that return their values.
* @param target The target object.
* @param path The path to the property to convert into a function.
*/
export declare const functionify: <Theme = DefaultTheme, Target = any>(target: Target, path?: Array<string>) => Functionified<Theme, Target>;
export {};