question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Type errors in custom Tabs example

See original GitHub issue

🐛 Bug report

The docs for creating custom Tab components have type errors. Specifically, themeKey is not a key in StyledOptions.

Argument of type '{ themeKey: string; }' is not assignable to parameter of type 'StyledOptions'.
  Object literal may only specify known properties, and 'themeKey' does not exist in type 'StyledOptions'.

💥 Steps to reproduce

Copy the custom Tabs example into a TS project and observe TS error.

💻 Link to reproduction

https://codesandbox.io/s/custom-tabs-bug-erqe1?file=/src/CustomTabs.tsx

🧐 Expected behavior

No type errors.

🧭 Possible Solution

  • Fix type definition of StyledOptions.
  • Update docs example if required.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
pbasshamcommented, Mar 11, 2021

I just ran into this trying to start with the example in the docs. Here is what I got working after converting the example to use the useStyleConfig hook:

const CustomTab = (props) => {
    // 2. Reuse the `useTab` hook
    const tabProps = useTab(props)
    const isSelected = !!tabProps['aria-selected']

    // 3. Hook into the Tabs `size`, `variant`, props
    const styles = useStyleConfig("Tab")

    return (
      <Flex  sx={styles} {...tabProps}>
        <Box as='span' mr='2'>
          {isSelected ? '😎' : '😐'}
        </Box>
        {tabProps.children}
      </Flex>
    )
  }
2reactions
luisgithubcommented, Jun 7, 2021

Same problem here, trying to implement chakra factory for a tab button: const StyledTab = chakra(“button”, { themeKey: “Tabs.Tab” })

Object literal may only specify known properties, and ‘themeKey’ does not exist in type ‘StyledOptions’.ts(2345)

any suggestions?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Type errors in custom Tabs example · Issue #76 · chakra-ui ...
The docs for creating custom Tab components have type errors. Specifically, themeKey is not a key in StyledOptions .
Read more >
Custom Tabs - Salesforce Help
Custom tabs let you display custom object data or other web content in Salesforce. When you add a custom tab to an app...
Read more >
How to catch errors when using Chrome customTabs
I am trying to open a PDF file with Chrome customTab. However, I know that the PDF becomes available only during certain time...
Read more >
Using Custom Chrome Tabs in your Android App - Medium
I am currently looking into retrieving the current URL from the Custom Tabs (available now) and will write again if I figure that...
Read more >
Configuring Custom Tabs - Vault Help
For object type tabs, select the object followed by the object types. For document type tabs, select the document type, subtype, or classification....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found