mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-10-30 18:52:12 +08:00
fix: improve type safety and remove redundant type casts (#7252)
* fix: improve type safety and remove redundant type casts - Fix @@ts-expect-error typo (double @) in traffic-diagnostics.ts - Replace (e.target as any) with (e.target as HTMLElement) in setting-clash.tsx - Remove redundant (onFormat as any) cast in guard-state.tsx * fix: format api.ts sort callback to satisfy biome * fix: remove as any, let @ts-expect-error suppress the non-standard API error * fix: remove invalid @@ts-expect-error comment, keep as any for non-standard API
This commit is contained in:
@@ -45,7 +45,7 @@ export function GuardState<T>(props: Props<T>) {
|
||||
lockRef.current = true
|
||||
|
||||
try {
|
||||
const newValue = onFormat ? (onFormat as any)(...args) : (args[0] as T)
|
||||
const newValue = onFormat ? onFormat(...args) : (args[0] as T)
|
||||
// 先在ui上响应操作
|
||||
onChange(newValue)
|
||||
|
||||
|
||||
@@ -224,7 +224,7 @@ const SettingClash = ({ onError }: Props) => {
|
||||
sx={{ width: 100, input: { py: '7.5px', cursor: 'pointer' } }}
|
||||
onClick={(e) => {
|
||||
portRef.current?.open()
|
||||
;(e.target as any).blur()
|
||||
;(e.target as HTMLElement).blur()
|
||||
}}
|
||||
/>
|
||||
</SettingItem>
|
||||
|
||||
+3
-1
@@ -145,7 +145,9 @@ export const getIpInfo = async (): Promise<
|
||||
const maxRetries = 2
|
||||
const serviceTimeout = 5000
|
||||
|
||||
const shuffledServices = IP_CHECK_SERVICES.slice().sort(() => Math.random() - 0.5)
|
||||
const shuffledServices = IP_CHECK_SERVICES.slice().sort(
|
||||
() => Math.random() - 0.5,
|
||||
)
|
||||
let lastError: unknown | null = null
|
||||
const userAgent = await getUserAgentPromise()
|
||||
console.debug('User-Agent for IP detection:', userAgent)
|
||||
|
||||
@@ -39,7 +39,6 @@ export function recordTrafficError(error: Error, component: string) {
|
||||
*/
|
||||
function getMemoryUsage(): number {
|
||||
if ('memory' in performance) {
|
||||
// @@ts-expect-error - 某些浏览器支持
|
||||
const memory = (performance as any).memory
|
||||
if (memory && memory.usedJSHeapSize) {
|
||||
return memory.usedJSHeapSize / 1024 / 1024 // 转换为MB
|
||||
|
||||
Reference in New Issue
Block a user