From 446161bd9c42384ee757c7c6c97e7fa73f5fc60d Mon Sep 17 00:00:00 2001 From: Nykolai Topchyi Date: Sun, 26 Apr 2020 02:38:21 +0300 Subject: [PATCH 1/3] fix index.ts --- packages/material-ui-system/src/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/material-ui-system/src/index.d.ts b/packages/material-ui-system/src/index.d.ts index 419bf11bf61c82..d17787413aa924 100644 --- a/packages/material-ui-system/src/index.d.ts +++ b/packages/material-ui-system/src/index.d.ts @@ -36,7 +36,7 @@ type DefaultBreakPoints = 'xs' | 'sm' | 'md' | 'lg' | 'xl'; */ export function breakpoints( styleFunction: StyleFunction -): StyleFunction>>; +): StyleFunction> & Props>; // compose.js /** @@ -56,7 +56,7 @@ export function compose>>(...args: T): Compos // css.js export function css( styleFunction: StyleFunction -): StyleFunction }>; +): StyleFunction }>; export const display: SimpleStyleFunction< 'display' | 'displayPrint' | 'overflow' | 'textOverflow' | 'visibility' | 'whiteSpace' From 150e5282279cbc8d15bfa3dda5ff78599dd424d4 Mon Sep 17 00:00:00 2001 From: Nykolai Topchyi Date: Sun, 26 Apr 2020 18:59:09 +0300 Subject: [PATCH 2/3] add typescript breakpointsTest --- .../material-ui-system/src/index.spec.tsx | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/material-ui-system/src/index.spec.tsx b/packages/material-ui-system/src/index.spec.tsx index 7c8375b053602d..ce18c57e70fd56 100644 --- a/packages/material-ui-system/src/index.spec.tsx +++ b/packages/material-ui-system/src/index.spec.tsx @@ -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'; @@ -66,3 +74,13 @@ function interopTest() { `; ; } + +function breakpointsTest() { + function styleFunction(props: { color?: string }) { + return {}; + } + + const styler = breakpoints(styleFunction); + // Allows styleFunction props + styler({ color: 'red' }); +} From 360bfa9edf9a4ebfc022fabed9e18d4d75dcbfc3 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Mon, 27 Apr 2020 11:01:26 +0200 Subject: [PATCH 3/3] focus on the breakpoints module --- packages/material-ui-system/src/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/material-ui-system/src/index.d.ts b/packages/material-ui-system/src/index.d.ts index d17787413aa924..b842b8ae821ad9 100644 --- a/packages/material-ui-system/src/index.d.ts +++ b/packages/material-ui-system/src/index.d.ts @@ -56,7 +56,7 @@ export function compose>>(...args: T): Compos // css.js export function css( styleFunction: StyleFunction -): StyleFunction }>; +): StyleFunction }>; export const display: SimpleStyleFunction< 'display' | 'displayPrint' | 'overflow' | 'textOverflow' | 'visibility' | 'whiteSpace'