Skip to content

Commit

Permalink
cockpit.d.ts: fix some cockpit.file() annotations
Browse files Browse the repository at this point in the history
These things take optional arguments to change their behaviour.

There is another issue in the binding that will be more difficult to
fix: our non-standard promise type supports multiple arguments to the
.then() callback.  We can't describe that using the `Promise` API which
we've subclassed.  We leave that alone for now.
  • Loading branch information
allisonkarlitskaya authored and martinpitt committed Jun 29, 2024
1 parent 00d7e1d commit d45e651
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/lib/cockpit.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ declare module 'cockpit' {

interface FileHandle<T> {
read(): Promise<T>;
replace(content: T): Promise<FileTag>;
replace(new_content: T, expected_tag?: FileTag): Promise<FileTag>;
watch(callback: FileWatchCallback<T>, options?: { read?: boolean }): FileWatchHandle;
modify(callback: (data: T) => T): Promise<[T, FileTag]>;
modify(callback: (data: T) => T, initial_content?: string, initial_tag?: FileTag): Promise<[T, FileTag]>;
close(): void;
path: string;
}
Expand Down

0 comments on commit d45e651

Please sign in to comment.