Skip to content

Commit

Permalink
typescript support
Browse files Browse the repository at this point in the history
  • Loading branch information
mnajdova committed Sep 22, 2023
1 parent 940164b commit 3fde4f6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
20 changes: 20 additions & 0 deletions packages/mui-styles/src/styled/styled.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,23 @@ function acceptanceTest() {
</React.Fragment>
);
}

function variantsAPI() {
const ObjectSyntax = styled('div')<{}, { foo?: string; bar?: number }>({
variants: [
{
props: { foo: 'a' },
style: { color: 'blue' },
},
],
});

const FunctionSyntax = styled('div')<{}, { foo?: string; bar?: number }>(() => ({
variants: [
{
props: { foo: 'a' },
style: { color: 'blue' },
},
],
}));
}
3 changes: 2 additions & 1 deletion packages/mui-styles/src/withStyles/withStyles.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ export interface CreateCSSProperties<Props extends object = {}>
// Allow pseudo selectors and media queries
[k: string]:
| BaseCreateCSSProperties<Props>[keyof BaseCreateCSSProperties<Props>]
| CreateCSSProperties<Props>;
| CreateCSSProperties<Props>
| Array<{ props: Props; style: CSSProperties }>;
}

/**
Expand Down

0 comments on commit 3fde4f6

Please sign in to comment.