mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-12-06 14:40:08 +08:00
refactor(ipc): generate bindings with Specta
This commit is contained in:
@@ -305,11 +305,7 @@ function extractDisplayText(input: unknown): string | undefined {
|
||||
}
|
||||
}
|
||||
|
||||
export interface CommandFailure {
|
||||
code?: string
|
||||
operation?: FailedOperation
|
||||
detail: string
|
||||
}
|
||||
import type { CommandFailure_Serialize as CommandFailure } from './bindings'
|
||||
|
||||
function isCommandFailure(input: unknown): input is CommandFailure {
|
||||
if (typeof input !== 'object' || input === null) return false
|
||||
@@ -495,11 +491,11 @@ const baseShowNotice = (
|
||||
}
|
||||
|
||||
function failureCode(input: unknown): string | undefined {
|
||||
return isCommandFailure(input) ? input.code : undefined
|
||||
return isCommandFailure(input) ? input.code! : undefined
|
||||
}
|
||||
|
||||
function failureOperation(input: unknown): FailedOperation | undefined {
|
||||
return isCommandFailure(input) ? input.operation : undefined
|
||||
return isCommandFailure(input) ? input.operation! : undefined
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user