@@ -24,21 +24,32 @@ let ResultingComponent: React.ComponentType<MyProps>
2424let ComponentTest : React . FC
2525
2626/* -------------------- Function Argument Passing Cases -------------------- */
27+ // Plain Object (no type supplied)
28+ function functionPlainObject ( theme : MyTheme ) {
29+ return {
30+ someClassName : '' ,
31+ anotherClassName : {
32+ fontWeight : 'bold'
33+ }
34+ }
35+ }
36+ ResultingComponent = withStyles ( functionPlainObject ) ( SimpleComponent )
37+ ComponentTest = ( ) => < ResultingComponent property = "" />
2738
2839// Plain Styles
29- function functionPlain ( theme : MyTheme ) : Styles {
40+ function functionPlainStyles ( theme : MyTheme ) : Styles {
3041 return {
3142 someClassName : '' ,
3243 anotherClassName : {
3344 fontWeight : 'bold'
3445 }
3546 }
3647}
37- ResultingComponent = withStyles ( functionPlain ) ( SimpleComponent )
48+ ResultingComponent = withStyles ( functionPlainStyles ) ( SimpleComponent )
3849ComponentTest = ( ) => < ResultingComponent property = "" />
3950
4051// With Props
41- function functionProps ( theme : MyTheme ) : Styles < MyProps > {
52+ function functionProps ( theme : MyTheme ) : Styles < string , MyProps > {
4253 return {
4354 someClassName : ( { property} ) => '' ,
4455 anotherClassName : {
@@ -50,7 +61,7 @@ ResultingComponent = withStyles(functionProps)(SimpleComponent)
5061ComponentTest = ( ) => < ResultingComponent property = "" />
5162
5263// With Props and ClassName rules
53- function functionPropsAndName ( theme : MyTheme ) : Styles < MyProps , undefined , number > {
64+ function functionPropsAndName ( theme : MyTheme ) : Styles < number , MyProps , undefined > {
5465 return {
5566 [ 1 ] : ( { property} ) => '' ,
5667 [ 2 ] : {
@@ -63,6 +74,16 @@ ComponentTest = () => <ResultingComponent property="" />
6374
6475/* -------------------- Regular Object Passing Cases -------------------- */
6576
77+ // Plain Object (no type supplied)
78+ const plainObject = {
79+ someClassName : '' ,
80+ anotherClassName : {
81+ fontWeight : 'bold'
82+ }
83+ }
84+ ResultingComponent = withStyles ( plainObject ) ( SimpleComponent )
85+ ComponentTest = ( ) => < ResultingComponent property = "" />
86+
6687// Plain Styles
6788const stylesPlain : Styles = {
6889 someClassName : '' ,
@@ -74,7 +95,7 @@ ResultingComponent = withStyles(stylesPlain)(SimpleComponent)
7495ComponentTest = ( ) => < ResultingComponent property = "" />
7596
7697// With Props
77- const stylesProps : Styles < MyProps > = {
98+ const stylesProps : Styles < string , MyProps > = {
7899 someClassName : ( { property} ) => '' ,
79100 anotherClassName : {
80101 fontWeight : 'bold'
@@ -84,7 +105,7 @@ ResultingComponent = withStyles(stylesProps)(SimpleComponent)
84105ComponentTest = ( ) => < ResultingComponent property = "" />
85106
86107// With Theme
87- const stylesTheme : Styles < unknown , MyTheme > = {
108+ const stylesTheme : Styles < string , unknown , MyTheme > = {
88109 someClassName : ( { theme} ) => '' ,
89110 anotherClassName : {
90111 fontWeight : 'bold'
@@ -94,7 +115,7 @@ ResultingComponent = withStyles(stylesTheme)(SimpleComponent)
94115ComponentTest = ( ) => < ResultingComponent property = "" />
95116
96117// With Props and Theme
97- const stylesPropsAndTheme : Styles < MyProps , MyTheme > = {
118+ const stylesPropsAndTheme : Styles < string , MyProps , MyTheme > = {
98119 someClassName : ( { property, theme} ) => '' ,
99120 anotherClassName : {
100121 fontWeight : 'bold'
@@ -104,7 +125,7 @@ ResultingComponent = withStyles(stylesPropsAndTheme)(SimpleComponent)
104125ComponentTest = ( ) => < ResultingComponent property = "" />
105126
106127// With Props and Theme and ClassName rules
107- const stylesPropsAndThemeAndName : Styles < MyProps , MyTheme , number > = {
128+ const stylesPropsAndThemeAndName : Styles < number , MyProps , MyTheme > = {
108129 [ 1 ] : ( { property, theme} ) => '' ,
109130 [ 2 ] : {
110131 fontWeight : 'bold'
@@ -116,7 +137,7 @@ ComponentTest = () => <ResultingComponent property="" />
116137/* -------------------- Failing Cases -------------------- */
117138
118139// A function argument cannot provide another defined theme type conflicting with `undefined`
119- function failingFunctionRedefineTheme ( theme : MyTheme ) : Styles < unknown , any > {
140+ function failingFunctionRedefineTheme ( theme : MyTheme ) : Styles < string , unknown , any > {
120141 return {
121142 someClassName : '' ,
122143 anotherClassName : {
@@ -125,7 +146,7 @@ function failingFunctionRedefineTheme(theme: MyTheme): Styles<unknown, any> {
125146 }
126147}
127148
128- function passingFunctionUnknownTheme ( theme : MyTheme ) : Styles < unknown , unknown > {
149+ function passingFunctionUnknownTheme ( theme : MyTheme ) : Styles < string , unknown , unknown > {
129150 return {
130151 someClassName : '' ,
131152 anotherClassName : {
@@ -134,7 +155,7 @@ function passingFunctionUnknownTheme(theme: MyTheme): Styles<unknown, unknown> {
134155 }
135156}
136157
137- function passingFunctionNullTheme ( theme : MyTheme ) : Styles < unknown , null > {
158+ function passingFunctionNullTheme ( theme : MyTheme ) : Styles < string , unknown , null > {
138159 return {
139160 someClassName : '' ,
140161 anotherClassName : {
0 commit comments