@@ -80,6 +80,24 @@ const themeArg6ClassesFail = themeArg6({theme: {}})
8080const themeArg6ClassesFail2 = themeArg6 ( { theme : expectedDefaultTheme } )
8181const themeArg6ClassesPass = themeArg6 ( { theme : expectedCustomTheme } )
8282
83+ // Props can be determined implicitly
84+ const themeArg7 = createUseStyles ( theme => ( {
85+ checkbox : ( { property} : MyProps ) => ( {
86+ borderColor : property
87+ } )
88+ } ) )
89+
90+ // @ts -expect-error invalid props
91+ const themeArg7ClassesFail = themeArg7 ( { colour : 'green' } )
92+ // @ts -expect-error extraneous props
93+ const themeArg7ClassesFail2 = themeArg7 ( { ...expectedCustomProps , someUnTypedProp : 1 } )
94+ const themeArg7ClassesPass = themeArg7 ( expectedCustomProps )
95+
96+ // Classes check
97+ const themeArgClasses7String : string = themeArg7ClassesPass . checkbox
98+ // @ts -expect-error invalid className
99+ themeArg7ClassesPass . doesntExist
100+
83101/* -------------------- NO THEME ARGUMENT -------------------- */
84102// Regular, static styles work fine
85103const noThemeArg1 = createUseStyles ( {
@@ -200,3 +218,21 @@ const noThemeArg7 = createUseStyles<MyProps, MyTheme>({
200218 }
201219 }
202220} )
221+
222+ // Props can be determined implicitly
223+ const noThemeArg8 = createUseStyles ( {
224+ checkbox : ( { property} : MyProps ) => ( {
225+ borderColor : property
226+ } )
227+ } )
228+
229+ // @ts -expect-error invalid props
230+ const noThemeArg8ClassesFail = noThemeArg8 ( { colour : 'green' } )
231+ // @ts -expect-error extraneous props
232+ const noThemeArg8ClassesFail2 = noThemeArg8 ( { ...expectedCustomProps , someUnTypedProp : 1 } )
233+ const noThemeArg8ClassesPass = noThemeArg8 ( expectedCustomProps )
234+
235+ // Classes check
236+ const noThemeArg8ClassesString : string = noThemeArg8ClassesPass . checkbox
237+ // @ts -expect-error invalid className
238+ noThemeArg8ClassesPass . doesntExist
0 commit comments