-
Notifications
You must be signed in to change notification settings - Fork 3
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
tw global not defined in TypeScript #37
Comments
Sorry for the delay, I've been on holiday 🏄 I currently don't export stailwc.d.ts and the recommendation is to just put that file into your project. It may make sense to just bundle it with the app but I am worried about that approach because it overrides things in the global namespace. I typically use a |
No problem @arlyon, hope it was a good break! I can see you've updated the docs to mention that now so that helps clarify. I agree with your concern about overriding globals at least in terms of the JSX stuff, and a conflict does happen in my case because the global In terms of the import { tw } from "stailwc";
<Example css={tw`block`} /> I think if you made the For the // global.d.ts
import 'styled-components/cssprop' Since as I mentioned there is a potential conflict there for styled-components users maybe it's simpler to just leave that one up to users, or I suppose you could offer two versions of the import? What do you think? |
I like that, actually. I deliberately left out tw from stailwc.d.ts because I prefer not having an import but that is a stylistic thing and we should support both. Perhaps we can add the tw function to the builtin types, as well as figure out a syntax for allowing direct import of the d.ts file, rather than having to copy and paste it. I will mark this as a feature request and see if I have time to pick it up (unless you beat me to it 😏) |
I'm having some issues with TypeScript since
tw
needs to be defined as a global. I can see stailwc.d.ts has the right types, but it's not included or exported in the published package. Should it be?Looking in node_modules, this is the contents of my installed copy of stailwc 0.17:
The text was updated successfully, but these errors were encountered: