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

Addon-themes: Make type generic less strict #26042

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion code/addons/themes/src/decorators/class-name.decorator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ const DEFAULT_ELEMENT_SELECTOR = 'html';

const classStringToArray = (classString: string) => classString.split(' ').filter(Boolean);

export const withThemeByClassName = <TRenderer extends Renderer = Renderer>({
// TODO check with @kasperpeulen: change the types so they can be correctly inferred from context e.g. <Story extends (...args: any[]) => any>
export const withThemeByClassName = <TRenderer extends Renderer = any>({
themes,
defaultTheme,
parentSelector = DEFAULT_ELEMENT_SELECTOR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export interface DataAttributeStrategyConfiguration {
const DEFAULT_ELEMENT_SELECTOR = 'html';
const DEFAULT_DATA_ATTRIBUTE = 'data-theme';

export const withThemeByDataAttribute = <TRenderer extends Renderer = Renderer>({
// TODO check with @kasperpeulen: change the types so they can be correctly inferred from context e.g. <Story extends (...args: any[]) => any>
export const withThemeByDataAttribute = <TRenderer extends Renderer = any>({
themes,
defaultTheme,
parentSelector = DEFAULT_ELEMENT_SELECTOR,
Expand Down
3 changes: 2 additions & 1 deletion code/addons/themes/src/decorators/provider.decorator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export interface ProviderStrategyConfiguration {

const pluckThemeFromKeyPairTuple = ([_, themeConfig]: [string, Theme]): Theme => themeConfig;

export const withThemeFromJSXProvider = <TRenderer extends Renderer = Renderer>({
// TODO check with @kasperpeulen: change the types so they can be correctly inferred from context e.g. <Story extends (...args: any[]) => any>
export const withThemeFromJSXProvider = <TRenderer extends Renderer = any>({
Provider,
GlobalStyles,
defaultTheme,
Expand Down
Loading