Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

makeStyles: Does not correctly handle sequence expressions #21009

Closed
khmakoto opened this issue Dec 13, 2021 · 0 comments · Fixed by #21010
Closed

makeStyles: Does not correctly handle sequence expressions #21009

khmakoto opened this issue Dec 13, 2021 · 0 comments · Fixed by #21010

Comments

@khmakoto
Copy link
Member

khmakoto commented Dec 13, 2021

This problem affected #20918 and #20657:

ERROR in /mnt/vss/_work/1/s/packages/react-switch/src/components/Switch/useSwitchStyles.ts
Module build failed (from /mnt/vss/_work/1/s/packages/make-styles-webpack-loader/lib/index.js):
SyntaxError: /mnt/vss/_work/1/s/packages/react-switch/src/components/Switch/useSwitchStyles.ts: We met an unhandled case, this is a bug, please include a stacktrace and report it at https://github.com/microsoft/fluentui
  56 |     verticalAlign: 'bottom'
  57 |   },
> 58 |   unchecked: (_a = {}, _a[":hover ." + thumbClassName] = {
     |   ^
  59 |     ':before': {
  60 |       backgroundColor: react_theme_1.tokens.colorNeutralStrokeAccessibleHover
  61 |     }
    at File.buildCodeFrameError (/mnt/vss/_work/1/s/node_modules/@babel/core/lib/transformation/file/file.js:244:12)
    at NodePath.buildCodeFrameError (/mnt/vss/_work/1/s/node_modules/@babel/traverse/lib/path/index.js:133:21)

@layershifter and I traced it down to a minimal repro:

import { makeStyles, MakeStylesStyle } from '@fluentui/react-make-styles';

const switchClassName = 'fui-Switch';
let _a: Record<string, MakeStylesStyle>;

export const useStyles = makeStyles({
  root:
    ((_a = {}),
    (_a[':hover .' + switchClassName] = {
      ':before': {
        backgroundColor: 'red',
      },
    }),
    _a),
});
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants