Skip to content

Possible memory leak with TypeScript when importing SxStyleProp objects #1162

Answered by jorisw
jorisw asked this question in General
Discussion options

You must be logged in to vote

Another thing we're doing is composing SxStyleProps objects like so:

  const selectStyles: SxStyleProp = {
    ...defaultSelectStyles,
    ...filledOrEmptySelectStyles,
    ...(showSmallLabel ? withSmallLabelSelectStyles : {}),
    ...(focused || hovered ? focusedOrHoveredSelectStyles : {}),
    ...(readOnly || disabled ? disabledStyles : {}),
    ...(hovered ? hoveredStyles : {}),
    ...(focused ? focusedStyles : {}),
    ...(hasErrors ? errorStyles : {}),
    ...(hasWarnings ? warningStyles : {}),
  }

Is this the wrong way to go about it?

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@hasparus
Comment options

@jorisw
Comment options

Answer selected by hasparus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants