React18: Update useCallback arg types where needed (#57084)

This commit is contained in:
kay delaney
2022-10-17 14:52:12 +01:00
committed by GitHub
parent b1128e0b8c
commit 5d53a983d8
21 changed files with 64 additions and 58 deletions

View File

@@ -58,7 +58,7 @@ export const FilterByValueFilterEditor = (props: Props) => {
);
const onChangeMatcherOptions = useCallback(
(options) => {
(options: unknown) => {
onChange({
...filter,
config: {

View File

@@ -21,11 +21,11 @@ const fieldNamePickerSettings: StandardEditorsRegistryItem<string, FieldNamePick
settings: { width: 24 },
} as any;
export const ConvertFieldTypeTransformerEditor: React.FC<TransformerUIProps<ConvertFieldTypeTransformerOptions>> = ({
export const ConvertFieldTypeTransformerEditor = ({
input,
options,
onChange,
}) => {
}: TransformerUIProps<ConvertFieldTypeTransformerOptions>) => {
const allTypes: Array<SelectableValue<FieldType>> = [
{ value: FieldType.number, label: 'Numeric' },
{ value: FieldType.string, label: 'String' },
@@ -35,7 +35,7 @@ export const ConvertFieldTypeTransformerEditor: React.FC<TransformerUIProps<Conv
];
const onSelectField = useCallback(
(idx) => (value: string | undefined) => {
(idx: number) => (value: string | undefined) => {
const conversions = options.conversions;
conversions[idx] = { ...conversions[idx], targetField: value ?? '' };
onChange({
@@ -47,7 +47,7 @@ export const ConvertFieldTypeTransformerEditor: React.FC<TransformerUIProps<Conv
);
const onSelectDestinationType = useCallback(
(idx) => (value: SelectableValue<FieldType>) => {
(idx: number) => (value: SelectableValue<FieldType>) => {
const conversions = options.conversions;
conversions[idx] = { ...conversions[idx], destinationType: value.value };
onChange({
@@ -59,7 +59,7 @@ export const ConvertFieldTypeTransformerEditor: React.FC<TransformerUIProps<Conv
);
const onInputFormat = useCallback(
(idx) => (e: ChangeEvent<HTMLInputElement>) => {
(idx: number) => (e: ChangeEvent<HTMLInputElement>) => {
const conversions = options.conversions;
conversions[idx] = { ...conversions[idx], dateFormat: e.currentTarget.value };
onChange({
@@ -81,7 +81,7 @@ export const ConvertFieldTypeTransformerEditor: React.FC<TransformerUIProps<Conv
}, [onChange, options]);
const onRemoveConvertFieldType = useCallback(
(idx) => {
(idx: number) => {
const removed = options.conversions;
removed.splice(idx, 1);
onChange({