Skip to content

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

@FedericoCasarella

Description

@FedericoCasarella

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions