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

ThemeProp should not be optional #42

Open
thegurneet opened this issue Nov 7, 2022 · 3 comments
Open

ThemeProp should not be optional #42

thegurneet opened this issue Nov 7, 2022 · 3 comments

Comments

@thegurneet
Copy link

The ThemeProp needs to be changed from optional to required if the ThemeProvider has theme as required.

This is causing props to be either DefaultTheme | undefined, when a theme is clearly defined.

Screenshot 2022-11-07 at 14 15 17
Screenshot 2022-11-07 at 14 16 55

@specialdoom
Copy link

Anything on this?

@mlaopane
Copy link

When using a function, I'm not sure there is a way to figure out automatically what is the type of theme
(you might have not initialized the theme in the first place).

Ideally the type should be inferred when providing it as a generic type.

const myTheme = {
  color: {
    backgroundColor: '#123'
  }
}
const SomeText = styled("div")<{ theme: typeof myTheme }>``;

PS : Please do not provide only screenshots when opening an issue 🙏🏽

@thegurneet
Copy link
Author

The screenshot in this instance provided enough information.

`const SomeText = styled("div")<{ theme: typeof myTheme }>``

Defining the theme like this is wrong. For each no styled component I will have to define the theme as typeof myTheme.

The documentation solid-styled-components is based of: https://styled-components.com/docs/advanced

The theme is always defined by default, we simply extend onto it by giving it more props.

dluhauskoitulaco pushed a commit to dluhauskoitulaco/solid-styled-components that referenced this issue Jun 21, 2024
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