Skip to content

Commit

Permalink
Fix types in docs/tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kqualters-elastic committed Nov 18, 2023
1 parent fc625d0 commit 3248acc
Show file tree
Hide file tree
Showing 5 changed files with 178 additions and 181 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
"build-docs": "cross-env BABEL_MODULES=false cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=4096 webpack --config=src-docs/webpack.config.js",
"build": "yarn extract-i18n-strings && node ./scripts/compile-clean.js && node ./scripts/compile-eui.js && yarn compile-scss",
"build-pack": "yarn build && npm pack",
"check-types": "yarn tsc --noEmit",
"compile-icons": "node ./scripts/compile-icons.js && prettier --write --loglevel=warn \"./src/components/icon/assets/**/*.tsx\"",
"compile-scss": "node ./scripts/compile-scss.js",
"extract-i18n-strings": "node ./scripts/babel/fetch-i18n-strings",
"lint": "yarn tsc --noEmit && yarn lint-es && yarn lint-css-in-js && yarn lint-sass",
"lint": "yarn check-types && yarn lint-es && yarn lint-css-in-js && yarn lint-sass",
"lint-fix": "yarn lint-es --fix && yarn lint-css-in-js --fix",
"lint-es": "eslint --cache \"{src,src-docs}/**/*.{ts,tsx,js}\" --max-warnings 0",
"lint-css-in-js": "yarn stylelint \"**/*.styles.ts\" \"./src/themes/**/*.ts\" \"./src/global_styling/**/*.ts\" --quiet-deprecation-warnings",
Expand Down
6 changes: 5 additions & 1 deletion src-docs/src/views/datagrid/toolbar/additional_controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
EuiContextMenuPanel,
EuiPopover,
EuiDataGridPaginationProps,
renderCellValue,
} from '../../../../../src';

const columns = [
Expand Down Expand Up @@ -49,6 +50,9 @@ for (let i = 1; i < 20; i++) {
});
}

const renderCellValue: renderCellValue = ({ rowIndex, columnId }) =>
data[rowIndex][columnId];

export default () => {
const [pagination, setPagination] = useState({ pageIndex: 0 });
const [isFlyoutVisible, setIsFlyoutVisible] = useState(false);
Expand Down Expand Up @@ -126,7 +130,7 @@ export default () => {
border: 'horizontal',
header: 'underline',
}}
renderCellValue={({ rowIndex, columnId }) => data[rowIndex][columnId]}
renderCellValue={renderCellValue}
pagination={{
...pagination,
onChangeItemsPerPage: setPageSize,
Expand Down
8 changes: 3 additions & 5 deletions src/components/datagrid/body/data_grid_body_custom.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import React, { useEffect } from 'react';
import { fireEvent } from '@testing-library/react';
import { render } from '../../../test/rtl';

import { EuiDataGridProps } from '../data_grid_types';
import { EuiDataGridProps, renderCellValue } from '../data_grid_types';
import { dataGridBodyProps } from './data_grid_body.test';

import { EuiDataGridBodyCustomRender } from './data_grid_body_custom';
Expand All @@ -21,10 +21,8 @@ describe('EuiDataGridBodyCustomRender', () => {
{ columnA: 'hello', columnB: 'world' },
{ columnA: 'lorem', columnB: 'ipsum' },
];
const RenderCellValue: EuiDataGridProps['renderCellValue'] = ({
rowIndex,
columnId,
}) => raw_data[rowIndex][columnId as keyof DataType];
const RenderCellValue: renderCellValue = ({ rowIndex, columnId }) =>
raw_data[rowIndex][columnId as keyof DataType];

const bodyProps = {
...dataGridBodyProps,
Expand Down
Loading

0 comments on commit 3248acc

Please sign in to comment.