Chore: avoid implicit any by using inline functions (#51338)

This commit is contained in:
Ryan McKinley 2022-06-23 11:19:08 -07:00 committed by GitHub
parent 91ee019140
commit a093250dd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 30 deletions

View File

@ -3194,18 +3194,14 @@ exports[`no type assertions`] = {
[26, 25, 60, "Do not use any type assertions.", "1006626118"], [26, 25, 60, "Do not use any type assertions.", "1006626118"],
[61, 21, 28, "Do not use any type assertions.", "1547636696"] [61, 21, 28, "Do not use any type assertions.", "1547636696"]
], ],
"public/app/features/search/page/components/FolderSection.tsx:2694034564": [
[139, 27, 22, "Do not use any type assertions.", "3217586069"]
],
"public/app/features/search/page/components/ManageActions.tsx:2913473343": [ "public/app/features/search/page/components/ManageActions.tsx:2913473343": [
[47, 28, 26, "Do not use any type assertions.", "1971436753"] [47, 28, 26, "Do not use any type assertions.", "1971436753"]
], ],
"public/app/features/search/page/components/MoveToFolderModal.tsx:739519709": [ "public/app/features/search/page/components/MoveToFolderModal.tsx:739519709": [
[66, 51, 15, "Do not use any type assertions.", "3135191849"] [66, 51, 15, "Do not use any type assertions.", "3135191849"]
], ],
"public/app/features/search/page/components/SearchResultsCards.tsx:4110686088": [ "public/app/features/search/page/components/SearchResultsCards.tsx:590892204": [
[54, 21, 56, "Do not use any type assertions.", "1375039711"], [45, 21, 56, "Do not use any type assertions.", "1375039711"]
[94, 31, 22, "Do not use any type assertions.", "3217586069"]
], ],
"public/app/features/search/page/components/SearchResultsGrid.tsx:994645204": [ "public/app/features/search/page/components/SearchResultsGrid.tsx:994645204": [
[30, 16, 28, "Do not use any type assertions.", "1941050010"] [30, 16, 28, "Do not use any type assertions.", "1941050010"]
@ -10059,15 +10055,9 @@ exports[`no explicit any`] = {
"public/app/features/search/components/SearchResults.tsx:4264592788": [ "public/app/features/search/components/SearchResults.tsx:4264592788": [
[19, 35, 3, "Unexpected any. Specify a different type.", "193409811"] [19, 35, 3, "Unexpected any. Specify a different type.", "193409811"]
], ],
"public/app/features/search/page/components/FolderSection.tsx:2694034564": [
[139, 46, 3, "Unexpected any. Specify a different type.", "193409811"]
],
"public/app/features/search/page/components/MoveToFolderModal.tsx:739519709": [ "public/app/features/search/page/components/MoveToFolderModal.tsx:739519709": [
[31, 63, 3, "Unexpected any. Specify a different type.", "193409811"] [31, 63, 3, "Unexpected any. Specify a different type.", "193409811"]
], ],
"public/app/features/search/page/components/SearchResultsCards.tsx:4110686088": [
[94, 50, 3, "Unexpected any. Specify a different type.", "193409811"]
],
"public/app/features/search/page/components/SearchResultsGrid.test.tsx:2090205358": [ "public/app/features/search/page/components/SearchResultsGrid.test.tsx:2090205358": [
[40, 35, 3, "Unexpected any. Specify a different type.", "193409811"] [40, 35, 3, "Unexpected any. Specify a different type.", "193409811"]
], ],

View File

@ -99,12 +99,6 @@ export const FolderSection: FC<SectionHeaderProps> = ({
} }
}; };
const onToggleChecked = (item: DashboardSectionItem) => {
if (selectionToggle) {
selectionToggle('dashboard', item.uid!);
}
};
const id = useUniqueId(); const id = useUniqueId();
const labelId = `section-header-label-${id}`; const labelId = `section-header-label-${id}`;
@ -137,7 +131,11 @@ export const FolderSection: FC<SectionHeaderProps> = ({
key={v.uid} key={v.uid}
item={v} item={v}
onTagSelected={onTagSelected} onTagSelected={onTagSelected}
onToggleChecked={onToggleChecked as any} onToggleChecked={(item) => {
if (selectionToggle) {
selectionToggle('dashboard', item.uid!);
}
}}
editable={Boolean(selection != null)} editable={Boolean(selection != null)}
/> />
); );

View File

@ -41,15 +41,6 @@ export const SearchResultsCards = React.memo(
} }
}, [response, listEl]); }, [response, listEl]);
const onToggleChecked = useCallback(
(item: DashboardSectionItem) => {
if (selectionToggle) {
selectionToggle('dashboard', item.uid!);
}
},
[selectionToggle]
);
const RenderRow = useCallback( const RenderRow = useCallback(
({ index: rowIndex, style }) => { ({ index: rowIndex, style }) => {
const meta = response.view.dataFrame.meta?.custom as SearchResultMeta; const meta = response.view.dataFrame.meta?.custom as SearchResultMeta;
@ -92,13 +83,17 @@ export const SearchResultsCards = React.memo(
<SearchItem <SearchItem
item={v} item={v}
onTagSelected={onTagSelected} onTagSelected={onTagSelected}
onToggleChecked={onToggleChecked as any} onToggleChecked={(item) => {
if (selectionToggle) {
selectionToggle('dashboard', item.uid!);
}
}}
editable={Boolean(selection != null)} editable={Boolean(selection != null)}
/> />
</div> </div>
); );
}, },
[response.view, highlightIndex, styles, onTagSelected, selection, selectionToggle, onToggleChecked] [response.view, highlightIndex, styles, onTagSelected, selection, selectionToggle]
); );
if (!response.totalRows) { if (!response.totalRows) {