type Needle = string | ((props?: Props) => any); export function prop( path: string, defaultValue?: T ): (props?: Props) => Props[keyof Props] | T; export function theme( path: string, defaultValue?: T ): ( props: Props & { theme: Theme } ) => Theme[keyof Theme] | T; type ThemeWithPalette = { palette?: { [key: string]: any }; }; interface Palette { (tone?: number): ( props: Props & { theme: Theme; palette?: keyof Theme["palette"]; tone?: number; } ) => any; (tone: number, defaultValue: any): ( props: Props & { theme: Partial; palette?: keyof Theme["palette"] } ) => any; (key: string, tone?: number): ( props: Props & { theme: Theme; tone?: number } ) => any; (key: string, defaultValue?: Exclude): < Props, Theme extends ThemeWithPalette >( props: Props & { theme: Theme; tone?: number } ) => any; (key: string, tone: number, defaultValue?: Exclude): < Props, Theme extends ThemeWithPalette >( props: Props & { theme: Theme } ) => any; } export const palette: Palette; export function ifProp( test: Needle | Needle[] | { [key: string]: any }, pass?: Pass, fail?: Fail ):

(props?: P) => (Pass extends (...args: any) => any ? ReturnType : Pass ) | (Fail extends (...args: any) => any ? ReturnType : Fail); export function ifNotProp( test: Needle | Needle[] | { [key: string]: any }, pass?: Pass, fail?: Fail ):

(props?: P) => (Pass extends (...args: any) => any ? ReturnType : Pass) | (Fail extends (...args: any) => any ? ReturnType : Fail); export function switchProp( needle: Needle, cases: { [key: string]: T } | ((props: Props) => { [key: string]: T }), defaultCase?: DefaultCase ):

(props?: P) => T | DefaultCase; export function withProp( needle: Needle | Needle[], fn: (...args: any[]) => T ):

(props?: P) => T;