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.

Why are so many things broken at once?

See original GitHub issue

In a create-react-app project using TypeScript and styled-components

After update to 1.1.0

import tw, {TwStyle} from 'twin.macro';

=> console

✕ Twin doesn't recognize { TwStyle }

Try one of these imports:
import { tw, styled, css } from twin.macro

2.a.

import 'twin.macro';
...
<button
   type="button"
   tw="hover:bg-teal-500 hover:text-white flex items-center block px-6 py-4 mr-2 font-bold text-teal-500 border border-teal-500 rounded-sm">
  	Previous page
</button>

Screenshot_20200520_161816

OR

2.b.

import tw from 'twin.macro';
import {css} from 'styled-components';

<button
   type="button"
   css={[
          tw`hover:text-white hover:bg-teal-500 flex items-center block px-6 py-4 mr-2 font-bold text-teal-500 border border-teal-500 rounded-sm`,
        ]}
   >
   Previous page
</button>

Screenshot_20200520_161816

3

import 'twin.macro';

<button type="button" tw="hover:text-white">
        Previous page
</button>

with autoCssProp: true, in babel-plugin-macros.config.js

Screenshot_20200520_163728

@ben-rogerson

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
ben-rogersoncommented, May 20, 2020

@abhijithvijayan Thanks for the raising these issues. We’ve just added a fix in 1.1.1 to allow TwStyle to be imported

1reaction
abhijithvijayancommented, May 20, 2020

@rbutera indeed.

@ben-rogerson I use strict-typing and some other rules that won’t allow building unless I typesafe every return function.

I used thr TwStyle as the styled block return type.

It was fine in 1.0.0 btw.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What It Means When Everything is Breaking - Walkabout Saga
Why it's a good sign when things start to break. Okay, not all the time, but sometimes. Here's what I mean.
Read more >
Why do I break everything I touch? - Quora
The item has been placed in several different places before. Your memory just plucked the wrong place out of your head - the...
Read more >
Why broken bones are a big deal in adulthood
As we age, broken bones can take much longer to heal and can point to more serious health concerns like Osteoporosis or other...
Read more >
After a Broken Bone, the Risk of a Second Fracture
These second fractures can result in life-limiting disability and a permanent loss of independence. One in five patients dies within a year of ......
Read more >
7 Things To Remember When You Feel Broken Inside - Lifehack
If "I am broken" is what you think to yourself, you can't miss this article. These 7 things will help you to hold...
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