chore(types): replace deprecated FormEvent with SyntheticEvent

React 19's @types/react flags FormEvent as deprecated — quote: 'FormEvent
doesn't actually exist. You probably meant to use ChangeEvent, InputEvent,
SubmitEvent, or just SyntheticEvent'. All 17 call sites in this repo
typed form onSubmit handlers and only called e.preventDefault(), so
SyntheticEvent is the correct general replacement.

No behavior change — pure type-level cleanup that clears the chronic
deprecation hint that has been showing up after every edit to any
form-bearing page.
This commit is contained in:
c0mrade
2026-05-26 15:24:01 +03:00
parent 62eaef2f53
commit cf469a1a9f
17 changed files with 21 additions and 21 deletions

View File

@@ -1,4 +1,4 @@
import { useEffect, useState, type FormEvent } from 'react';
import { useEffect, useState, type SyntheticEvent } from 'react';
import { createPortal } from 'react-dom';
import { useTranslation } from 'react-i18next';
import { useFocusTrap } from '../hooks/useFocusTrap';
@@ -25,7 +25,7 @@ export function PromptDialogHost() {
if (!request) return null;
const handleSubmit = (e: FormEvent) => {
const handleSubmit = (e: SyntheticEvent) => {
e.preventDefault();
const trimmed = value.trim();
if (!trimmed) {

View File

@@ -1704,7 +1704,7 @@ export default function AdminBulkActions() {
return () => clearTimeout(searchTimerRef.current);
}, []);
const handleSearchSubmit = (e: React.FormEvent) => {
const handleSearchSubmit = (e: React.SyntheticEvent) => {
e.preventDefault();
clearTimeout(searchTimerRef.current);
setOffset(0);

View File

@@ -82,7 +82,7 @@ export default function AdminPartnerSettings() {
formData.withdrawal_cooldown_days <= 365;
const isValid = !formData.withdrawal_enabled || (isMinAmountValid && isCooldownValid);
const handleSubmit = (e: React.FormEvent) => {
const handleSubmit = (e: React.SyntheticEvent) => {
e.preventDefault();
if (!isValid) return;
updateMutation.mutate({

View File

@@ -320,7 +320,7 @@ export default function AdminPolicyEdit() {
}, []);
const handleSubmit = useCallback(
(e: React.FormEvent) => {
(e: React.SyntheticEvent) => {
e.preventDefault();
setFormError(null);

View File

@@ -351,7 +351,7 @@ export default function AdminRoleAssign() {
}, []);
const handleAssign = useCallback(
(e: React.FormEvent) => {
(e: React.SyntheticEvent) => {
e.preventDefault();
setFormError(null);
setFormSuccess(null);

View File

@@ -334,7 +334,7 @@ export default function AdminRoleEdit() {
}, []);
const handleSubmit = useCallback(
(e: React.FormEvent) => {
(e: React.SyntheticEvent) => {
e.preventDefault();
setFormError(null);

View File

@@ -54,7 +54,7 @@ export default function AdminServerEdit() {
},
});
const handleSubmit = (e: React.FormEvent) => {
const handleSubmit = (e: React.SyntheticEvent) => {
e.preventDefault();
const data: ServerUpdateRequest = {
display_name: displayName,

View File

@@ -87,7 +87,7 @@ export default function AdminTicketSettings() {
const isValid =
!formData.sla_enabled || (isSlaMinutesValid && isCheckIntervalValid && isReminderCooldownValid);
const handleSubmit = (e: React.FormEvent) => {
const handleSubmit = (e: React.SyntheticEvent) => {
e.preventDefault();
if (!isValid) return;
updateMutation.mutate({

View File

@@ -177,7 +177,7 @@ export default function AdminTickets() {
}
};
const handleReply = async (e: React.FormEvent) => {
const handleReply = async (e: React.SyntheticEvent) => {
e.preventDefault();
if (!selectedTicketId) return;
if (attachments.some((a) => a.uploading || a.error)) return;

View File

@@ -1221,7 +1221,7 @@ export default function AdminTrafficUsage() {
}
}, [toast]);
const handleSearch = (e: React.FormEvent) => {
const handleSearch = (e: React.SyntheticEvent) => {
e.preventDefault();
setOffset(0);
setCommittedSearch(searchInput);

View File

@@ -210,7 +210,7 @@ export default function AdminUsers() {
});
const stats = statsQuery.data ?? null;
const handleSearch = (e: React.FormEvent) => {
const handleSearch = (e: React.SyntheticEvent) => {
e.preventDefault();
};

View File

@@ -1076,7 +1076,7 @@ function InlinePrizeForm({
promo_traffic_gb: prize?.promo_traffic_gb || 0,
});
const handleSubmit = (e: React.FormEvent) => {
const handleSubmit = (e: React.SyntheticEvent) => {
e.preventDefault();
onSave({
...formData,

View File

@@ -420,7 +420,7 @@ export default function ConnectedAccounts() {
},
});
const handleEmailSubmit = (e: React.FormEvent) => {
const handleEmailSubmit = (e: React.SyntheticEvent) => {
e.preventDefault();
setEmailError(null);
setEmailSuccess(null);

View File

@@ -221,7 +221,7 @@ export default function Login() {
}
};
const handleEmailSubmit = async (e: React.FormEvent) => {
const handleEmailSubmit = async (e: React.SyntheticEvent) => {
e.preventDefault();
setError('');
@@ -282,7 +282,7 @@ export default function Login() {
}
};
const handleForgotPassword = async (e: React.FormEvent) => {
const handleForgotPassword = async (e: React.SyntheticEvent) => {
e.preventDefault();
setForgotPasswordError('');

View File

@@ -1,4 +1,4 @@
import { useState, useEffect, type FormEvent } from 'react';
import { useState, useEffect, type SyntheticEvent } from 'react';
import { useNavigate } from 'react-router';
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { useTranslation } from 'react-i18next';
@@ -41,7 +41,7 @@ export default function ReferralPartnerApply() {
},
});
const handleSubmit = (e: FormEvent) => {
const handleSubmit = (e: SyntheticEvent) => {
e.preventDefault();
const payload: PartnerApplicationRequest = {};
if (form.company_name) payload.company_name = form.company_name;

View File

@@ -1,4 +1,4 @@
import { useState, useEffect, type FormEvent } from 'react';
import { useState, useEffect, type SyntheticEvent } from 'react';
import { useNavigate } from 'react-router';
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { useTranslation } from 'react-i18next';
@@ -37,7 +37,7 @@ export default function ReferralWithdrawalRequest() {
},
});
const handleSubmit = (e: FormEvent) => {
const handleSubmit = (e: SyntheticEvent) => {
e.preventDefault();
if (form.payment_details.length < 5) return;
if (form.amount_rubles <= 0) return;

View File

@@ -15,7 +15,7 @@ export default function ResetPassword() {
const [status, setStatus] = useState<'form' | 'loading' | 'success' | 'error'>('form');
const [error, setError] = useState('');
const handleSubmit = async (e: React.FormEvent) => {
const handleSubmit = async (e: React.SyntheticEvent) => {
e.preventDefault();
setError('');