From 3180fea53f4827c599e89369d613b33d4e167048 Mon Sep 17 00:00:00 2001 From: James Lawrence Date: Thu, 10 Jan 2019 01:06:44 +0000 Subject: [PATCH] Update tests - had to disable strict function checking, if anyone knows how to make it work with this, please do! --- types/react-jss/react-jss-tests.tsx | 59 ++++++++++++++++------------- types/react-jss/tsconfig.json | 2 +- 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/types/react-jss/react-jss-tests.tsx b/types/react-jss/react-jss-tests.tsx index 803170bb99..6e86bed492 100644 --- a/types/react-jss/react-jss-tests.tsx +++ b/types/react-jss/react-jss-tests.tsx @@ -17,42 +17,44 @@ interface MyTheme { /** * helper function to counter typescripts type widening */ -function createStyles(styles: Styles): Styles { +function createStyles(styles: Styles): Styles { return styles; } -const styles = (theme: MyTheme) => - createStyles({ - myButton: { - color: theme.color.primary, - margin: 1, - "& span": { - fontWeight: "revert" - } - }, - myLabel: { - fontStyle: "italic" - } - }); -interface ButtonProps extends WithSheet { +interface ButtonProps { label: string; + active?: boolean; } -const Button: React.SFC = ({ classes, children }) => { +const styles = (theme: MyTheme) => createStyles({ + myButton: { + color: (props: ButtonProps) => props.active ? 'red': theme.color.primary, + margin: 1, + "& span": { + fontWeight: "revert" + } + }, + myLabel: { + fontStyle: "italic" + } +}); +const Button: React.SFC> = ({active, classes, children}) => { return ( - + <> + + ); }; const ManuallyStyles = () => { return (