diff --git a/packages/@stylexjs/babel-plugin/src/utils/js-to-ast.js b/packages/@stylexjs/babel-plugin/src/utils/js-to-ast.js index cef5799a3..6b3726713 100644 --- a/packages/@stylexjs/babel-plugin/src/utils/js-to-ast.js +++ b/packages/@stylexjs/babel-plugin/src/utils/js-to-ast.js @@ -7,8 +7,6 @@ * @flow strict */ -import type { FlatCompiledStyles } from '../shared/common-types'; - import * as t from '@babel/types'; type NestedStringObject = $ReadOnly<{ @@ -37,9 +35,3 @@ export function convertObjectToAST( ), ); } - -export function removeObjectsWithSpreads(obj: { - +[string]: FlatCompiledStyles, -}): { +[string]: FlatCompiledStyles } { - return Object.fromEntries(Object.entries(obj).filter(Boolean)); -} diff --git a/packages/@stylexjs/babel-plugin/src/visitors/stylex-create.js b/packages/@stylexjs/babel-plugin/src/visitors/stylex-create.js index 4756ef365..fc049de3d 100644 --- a/packages/@stylexjs/babel-plugin/src/visitors/stylex-create.js +++ b/packages/@stylexjs/babel-plugin/src/visitors/stylex-create.js @@ -26,10 +26,7 @@ import { convertToTestStyles, injectDevClassNames, } from '../utils/dev-classname'; -import { - convertObjectToAST, - removeObjectsWithSpreads, -} from '../utils/js-to-ast'; +import { convertObjectToAST } from '../utils/js-to-ast'; import { messages } from '../shared'; import { evaluateStyleXCreateArg } from './parse-stylex-create-arg'; import flatMapExpandedShorthands from '../shared/preprocess-rules'; @@ -260,7 +257,9 @@ export default function transformStyleXCreate( } if (varName != null && isTopLevel(path)) { - const stylesToRemember = removeObjectsWithSpreads(compiledStyles); + const stylesToRemember = Object.fromEntries( + Object.entries(compiledStyles), + ); state.styleMap.set(varName, stylesToRemember); state.styleVars.set(varName, path.parentPath as $FlowFixMe); }