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 supports ClassNames, Props/Data, and Theme as type parameters (eg. Styles<Names, Data, Theme>). 1460
    • ๐Ÿ’… [react-jss][ts] withStyles and createUseStyles now support ClassNames, Props, and Theme as type parameters (eg. createUseStyles<Names, Props, Theme>). 1460
    • ๐Ÿ’… [react-jss][ts] useStyles finally expects the correct argument type: a Props object with an optional Theme property (both determined from createUseStyles). 1460
    • ๐Ÿ‘ [react-jss][ts] Support global TS theme definition 1453
    • ๐Ÿ’… [react-jss][ts] Allow partial classes prop in withStyles() 1428

    ๐Ÿ’ฅ Breaking Changes

    • ๐Ÿ’… [react-jss][ts] Theme is no longer the first generic type parameter for createUseStyles. 1460
      • There are two main ways to tell TS your Theme's type without reaching over the other type parameters:

    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}) => ({
        /* ... */
      })
    })