[react@18] Fix useCallback breaking type changes (#182344)

## Summary

Prep work for React@18 bump
https://github.com/elastic/kibana/issues/138222

In React@18 `useCallback` types has changed that introduced breaking
changes:
https://github.com/DefinitelyTyped/DefinitelyTyped/issues/46691

Fixed using:

https://github.com/eps1lon/types-react-codemod?tab=readme-ov-file#usecallback-implicit-any

**Tried to do my best with fixing the types, but if you disagree or have
a better idea how it should be solved feel free to suggest changes or
commit directly to the branch 🙏**

---------

Co-authored-by: Sergi Massaneda <sergi.massaneda@elastic.co>
Co-authored-by: Sébastien Loix <sabee77@gmail.com>
Co-authored-by: Nick Peihl <nick.peihl@elastic.co>
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
Co-authored-by: Felix Stürmer <felix.stuermer@elastic.co>
Co-authored-by: nickofthyme <nicholas.partridge@elastic.co>
Co-authored-by: Davis McPhee <davis.mcphee@elastic.co>
Co-authored-by: Vitalii Dmyterko <92328789+vitaliidm@users.noreply.github.com>
Co-authored-by: Maxim Palenov <maxim.palenov@elastic.co>
Co-authored-by: Christos Nasikas <christos.nasikas@elastic.co>
Co-authored-by: Anton Dosov <anton.dosov@elastic.co>
This commit is contained in:
Patryk Kopyciński 2024-08-28 16:33:35 +02:00 committed by GitHub
parent 97b54795f4
commit 2d1d592a3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
432 changed files with 1250 additions and 875 deletions

View file

@ -46,7 +46,7 @@ export const App = () => {
);
const onHighlight = useCallback(
(value) => dispatch({ type: 'setHighlightDetails', value }),
(value: any) => dispatch({ type: 'setHighlightDetails', value }),
[dispatch]
);

View file

@ -77,7 +77,10 @@ export const ProfileQueryEditor = memo(() => {
}
};
const onEditorReady = useCallback((editorInstance) => (editorRef.current = editorInstance), []);
const onEditorReady = useCallback(
(editorInstance: any) => (editorRef.current = editorInstance),
[]
);
const licenseEnabled = getLicenseStatus().valid;
return (