Skip to content

v10.6.0

Compare
Choose a tag to compare
@kof kof released this 14 Mar 09:04
· 106 commits to master since this release

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