From 79623a0a425600da302f66a2752afe35c96f6cf3 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 20 Aug 2024 09:40:06 +0200 Subject: [PATCH] lib: Fix cockpit.file().modify() annotation The callback can also return `null` to delete the file. --- pkg/lib/cockpit.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/lib/cockpit.d.ts b/pkg/lib/cockpit.d.ts index 589b86ebf872..819485d7f405 100644 --- a/pkg/lib/cockpit.d.ts +++ b/pkg/lib/cockpit.d.ts @@ -250,7 +250,7 @@ declare module 'cockpit' { read(): Promise; replace(new_content: T | null, expected_tag?: FileTag): Promise; watch(callback: FileWatchCallback, options?: { read?: boolean }): FileWatchHandle; - modify(callback: (data: T) => T, initial_content?: string, initial_tag?: FileTag): Promise<[T, FileTag]>; + modify(callback: (data: T | null) => T | null, initial_content?: string, initial_tag?: FileTag): Promise<[T, FileTag]>; close(): void; path: string; }