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

TypeScript inline definitions #2039

Closed
vorillaz opened this issue Dec 11, 2021 · 1 comment
Closed

TypeScript inline definitions #2039

vorillaz opened this issue Dec 11, 2021 · 1 comment
Labels
enhancement New feature or request types

Comments

@vorillaz
Copy link

vorillaz commented Dec 11, 2021

Describe the bug
Hi there, thanks a ton for the amazing library, it is a breeze using it.
I have a question regarding TypeScript inline definitions using the as prop:
Is there any way to use theme-ui along with TypeScript without redeclaring and exporting the component?

A solution as following would be amazing:

<Box<AmazingLinkProps> as="a" href="/buzz"></Box>

Screenshots
Screenshot 2021-12-11 at 11 51 31 PM

@lachlanjc lachlanjc linked a pull request Dec 11, 2021 that will close this issue
5 tasks
@lachlanjc lachlanjc added the enhancement New feature or request label Dec 11, 2021
@hasparus
Copy link
Member

hasparus commented Dec 11, 2021

Hey @vorillaz 👋 Thanks for the issue!

This is a footgun and won't be supported. Typed as prop is the easiest way to make your TypeScript compilation slow. You can use sx prop and JSX pragma instead.

/** @jsxImportSource theme-ui */

<a sx={{ color: "primary" }} />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request types
Projects
None yet
Development

No branches or pull requests

3 participants