Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 2 additions & 2 deletions packages/material-ui-system/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type DefaultBreakPoints = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
*/
export function breakpoints<Props, Breakpoints extends string = DefaultBreakPoints>(
styleFunction: StyleFunction<Props>
): StyleFunction<Partial<Record<Breakpoints, Props>>>;
): StyleFunction<Partial<Record<Breakpoints, Props>> & Props>;

// compose.js
/**
Expand All @@ -56,7 +56,7 @@ export function compose<T extends Array<StyleFunction<any>>>(...args: T): Compos
// css.js
export function css<Props>(
styleFunction: StyleFunction<Props>
): StyleFunction<Props & { css: Omit<Props, 'theme'> }>;
): StyleFunction<Props & { css?: Omit<Props, 'theme'> }>;
Copy link
Member

Choose a reason for hiding this comment

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

What about making a different pull request for the css concern? It would also be a good opportunity to add a JavaScript test case for it, I wasn't aware it was even working. Actually, I don't think that we should support it, rather encourage the other way around


export const display: SimpleStyleFunction<
'display' | 'displayPrint' | 'overflow' | 'textOverflow' | 'visibility' | 'whiteSpace'
Expand Down
20 changes: 19 additions & 1 deletion packages/material-ui-system/src/index.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { compose, css, palette, StyleFunction, spacing, style } from '@material-ui/system';
import {
compose,
css,
palette,
StyleFunction,
spacing,
style,
breakpoints,
} from '@material-ui/system';
import * as React from 'react';
import styled from 'styled-components';

Expand Down Expand Up @@ -66,3 +74,13 @@ function interopTest() {
`;
<SystemSpacingBox m={2} />;
}

function breakpointsTest() {
function styleFunction(props: { color?: string }) {
return {};
}

const styler = breakpoints(styleFunction);
// Allows styleFunction props
styler({ color: 'red' });
}