JSS v10.6.0 Release Notes
-
๐ Improvements
- ๐ฆ [*] Define specific polyfills for specific packages that will be required and define a policy for adding polyfills. Makes sure we will notice if a polyfill is needed in a supported browser by failing the CI. 1456
- ๐ [jss] Use
globalThis
to support secure version of JavaScript called SES 1449 - ๐
[jss][ts]
Styles
now supportsClassNames
,Props
/Data
, andTheme
as type parameters (eg.Styles<Names, Data, Theme>
). 1460 - ๐
[react-jss][ts]
withStyles
andcreateUseStyles
now supportClassNames
,Props
, andTheme
as type parameters (eg.createUseStyles<Names, Props, Theme>
). 1460 - ๐
[react-jss][ts]
useStyles
finally expects the correct argument type: aProps
object with an optionalTheme
property (both determined fromcreateUseStyles
). 1460 - ๐ [react-jss][ts] Support global TS theme definition 1453
- ๐
[react-jss][ts] Allow partial
classes
prop inwithStyles()
1428
๐ฅ Breaking Changes
- ๐
[react-jss][ts]
Theme
is no longer the first generic type parameter forcreateUseStyles
. 1460- There are two main ways to tell TS your
Theme
's type without reaching over the other type parameters:
- There are two main ways to tell TS your
Using the function argument.
const useStyles = createUseStyles(theme: Theme => ({ ruleName: { /* ... */ }; }))
Using the object argument with a function. (You will only need to specify the
Theme
type once.)const useStyles = createUseStyles({ ruleName: ({theme}: {theme: Theme}) => ({ /* ... */ }) })