Skip to content

Commit

Permalink
improve the type
Browse files Browse the repository at this point in the history
  • Loading branch information
mnajdova committed Sep 22, 2023
1 parent 3fde4f6 commit f4927a4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/mui-styles/src/styled/styled.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,14 @@ function variantsAPI() {
},
],
}));

const WrongUsage = styled('div')<{}, { foo?: string; bar?: number }>({
color: [
// @ts-expect-error the API is not valid for CSS properties
{
props: { foo: 'a' },
style: { color: 'blue' },
},
],
});
}
1 change: 1 addition & 0 deletions packages/mui-styles/src/withStyles/withStyles.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export type BaseCreateCSSProperties<Props extends object = {}> = {

export interface CreateCSSProperties<Props extends object = {}>
extends BaseCreateCSSProperties<Props> {
variants?: Array<{ props: Props; style: CSSProperties }>;
// Allow pseudo selectors and media queries
[k: string]:
| BaseCreateCSSProperties<Props>[keyof BaseCreateCSSProperties<Props>]
Expand Down

0 comments on commit f4927a4

Please sign in to comment.