mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
React18: Update useCallback arg types where needed (#57084)
This commit is contained in:
@@ -58,7 +58,7 @@ export const FilterByValueFilterEditor = (props: Props) => {
|
||||
);
|
||||
|
||||
const onChangeMatcherOptions = useCallback(
|
||||
(options) => {
|
||||
(options: unknown) => {
|
||||
onChange({
|
||||
...filter,
|
||||
config: {
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user