Skip to content
Discussion options

You must be logged in to vote

This is because the type React.AllHTMLAttributes does not include data-* attributes. A workaround would be something like this:

// explicitly typed for the data- attribute, without sacrificing type safety for the other button props
const buttonData = { 'data-testid': dataWorkspace.panel.addNewTable } as IButtonProps;

buttonProps={{
  id: StudioTourHooks.NEW_TABLE_BUTTON,
  text: formatMessage({ id: LocalizationConstant.TABLE }),
  onClick: AddTableButtonClick,
  ariaLabel: formatMessage({ id: LocalizationConstant.ADD_TABLE_BUTTON_ARIA_LABEL }),
  iconProps: { iconName: IconNames.Add },
  ...buttonData
}}

Hope that helps!

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@maralihart
Comment options

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