Skip to content

Commit

Permalink
solve TypeScript issue
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Oct 24, 2020
1 parent e0c2620 commit 711904a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
1 change: 0 additions & 1 deletion packages/grid/data-grid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"build": "cd ../ && rollup --config rollup.data-grid.config.js"
},
"dependencies": {
"@material-ui/utils": "^5.0.0-alpha.1",
"prop-types": "^15.7.2",
"tslib": "^2.0.0"
},
Expand Down
25 changes: 9 additions & 16 deletions packages/grid/data-grid/src/DataGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ const DataGrid2 = React.forwardRef<HTMLDivElement, DataGridProps>(function DataG
);
});

DataGrid2.propTypes = {
apiRef: chainPropTypes(PropTypes.any, (props) => {
(DataGrid2 as any).propTypes = {
apiRef: chainPropTypes(PropTypes.any, (props: any) => {
if (props.apiRef != null) {
throw new Error(
[
Expand All @@ -65,10 +65,9 @@ DataGrid2.propTypes = {
].join('\n'),
);
}

return null;
}),
columns: chainPropTypes(PropTypes.any, (props) => {
columns: chainPropTypes(PropTypes.any, (props: any) => {
if (props.columns && props.columns.some((column) => column.resizable)) {
throw new Error(
[
Expand All @@ -79,10 +78,9 @@ DataGrid2.propTypes = {
].join('\n'),
);
}

return null;
}),
disableColumnReorder: chainPropTypes(PropTypes.bool, (props) => {
disableColumnReorder: chainPropTypes(PropTypes.bool, (props: any) => {
if (props.disableColumnReorder === false) {
throw new Error(
[
Expand All @@ -93,10 +91,9 @@ DataGrid2.propTypes = {
].join('\n'),
);
}

return null;
}),
disableColumnResize: chainPropTypes(PropTypes.bool, (props) => {
disableColumnResize: chainPropTypes(PropTypes.bool, (props: any) => {
if (props.disableColumnResize === false) {
throw new Error(
[
Expand All @@ -107,10 +104,9 @@ DataGrid2.propTypes = {
].join('\n'),
);
}

return null;
}),
disableMultipleColumnsSorting: chainPropTypes(PropTypes.bool, (props) => {
disableMultipleColumnsSorting: chainPropTypes(PropTypes.bool, (props: any) => {
if (props.disableMultipleColumnsSorting === false) {
throw new Error(
[
Expand All @@ -121,10 +117,9 @@ DataGrid2.propTypes = {
].join('\n'),
);
}

return null;
}),
disableMultipleSelection: chainPropTypes(PropTypes.bool, (props) => {
disableMultipleSelection: chainPropTypes(PropTypes.bool, (props: any) => {
if (props.disableMultipleSelection === false) {
throw new Error(
[
Expand All @@ -135,10 +130,9 @@ DataGrid2.propTypes = {
].join('\n'),
);
}

return null;
}),
pageSize: chainPropTypes(PropTypes.number, (props) => {
pageSize: chainPropTypes(PropTypes.number, (props: any) => {
if (props.pageSize && props.pageSize > MAX_PAGE_SIZE) {
throw new Error(
[
Expand All @@ -149,10 +143,9 @@ DataGrid2.propTypes = {
].join('\n'),
);
}

return null;
}),
pagination: (props) => {
pagination: (props: any) => {
if (props.pagination === false) {
return new Error(
[
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2987,7 +2987,7 @@
prop-types "^15.7.2"
react-is "^16.8.0"

"@material-ui/utils@^5.0.0-alpha.1", "@material-ui/utils@^5.0.0-alpha.14":
"@material-ui/utils@^5.0.0-alpha.14":
version "5.0.0-alpha.14"
resolved "https://registry.yarnpkg.com/@material-ui/utils/-/utils-5.0.0-alpha.14.tgz#1f4458b511d64c3bf1260b25cca6dde565986bde"
integrity sha512-NIZNxDFUiTmr9cTA/iKYhqLBonlc3vgKfs+753NPjRoDhOj4aGr04yLvWegi4LbaIdu1veJTwGxXehypu1ud6Q==
Expand Down

0 comments on commit 711904a

Please sign in to comment.