Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

allow any kind of theme for themeProvider and helper methods #544

Merged
merged 1 commit into from
Oct 8, 2019

Conversation

cezaraugusto
Copy link
Contributor

This allows ThemedStyledComponentsModule to receive any theme as a prop. Needed for brave/brave-core#3300.

The reasoning I had is that we can type feature-specific themes in there instead of forcing a theme in root level. I'm open for discussion regarding better options.

@cezaraugusto cezaraugusto self-assigned this Oct 4, 2019
@@ -17,7 +17,7 @@ const {
// see: https://github.com/palantir/tslint/issues/3505
// It's possibly due to the rule upstream in tslint-config-standard
// tslint:disable-next-line
} = styledComponents as styledComponents.ThemedStyledComponentsModule<IThemeProps>
} = styledComponents as styledComponents.ThemedStyledComponentsModule<any>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's got to be a better way than just using any here, right? Wouldn't this lose all intellisense for theme props in all brave components (${p => p.theme.xyz})? Perhaps Partial<IThemeProps> would work?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial won't work. <IThemeProps & any> might, but not sure what that will get us. Maybe it's good. Either way seem comment on brave/brave-core#3300 as to whether this is needed yet.

Copy link
Member

@petemill petemill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving since brave/brave-core#3300 was merged, but with a caveat: This change will prevent any type checking for any theme properties in any component in any repo. That seems bad when theme properties will change often, and we'd want to catch any issues before release. @cezaraugusto to create the follow-up issue.

@cezaraugusto
Copy link
Contributor Author

follow-up issue #545

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants