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

Jest testing (typescript) - twin_macro_1.theme is not a function #842

Open
FedericoCasarella opened this issue Dec 6, 2023 · 2 comments

Comments

@FedericoCasarella
Copy link

Hey there,
so i tried to create a component using the following code (TS):

import tw, { theme } from 'twin.macro'

function Test(){
   const twColor: Record<string, string> = theme`colors`
   const twHeight = theme`height`

   return ( ... )
}

You can view a complete usage inside this template (Elstar-lite)

Once created the component i built a test using jest just trying to render it and jest throws error
TypeError: (0, twin_macro_1.theme) is not a function

on line:

const twColor: Record<string, string> = theme`colors` 

Hope i've been clear 👍 .
Thank you!

@ben-rogerson
Copy link
Owner

Check out some of the examples for setup info, like the styled-components-vite example - in your package.json I couldn't see any css-in-js lib installed or configured.

@kundalee
Copy link

Any suggestion to fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants