Skip to content

Commit

Permalink
fix: ts type error
Browse files Browse the repository at this point in the history
  • Loading branch information
hughfenghen committed Jun 15, 2024
1 parent 21c0311 commit aee587b
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/access-worker.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import { FileSystemSyncAccessHandle } from './common';
import OPFSWorker from './opfs-worker?worker&inline';

type Async<F> = F extends (...args: infer Params) => infer R
? (...args: Params) => Promise<R>
: never;

export type OPFSWorkerAccessHandle = {
read: (offset: number, size: number) => Promise<ArrayBuffer>;
write: Async<FileSystemSyncAccessHandle['write']>;
close: Async<FileSystemSyncAccessHandle['close']>;
truncate: Async<FileSystemSyncAccessHandle['truncate']>;
getSize: Async<FileSystemSyncAccessHandle['getSize']>;
flush: Async<FileSystemSyncAccessHandle['flush']>;
write: FileSystemSyncAccessHandle['write'];
close: FileSystemSyncAccessHandle['close'];
truncate: FileSystemSyncAccessHandle['truncate'];
getSize: FileSystemSyncAccessHandle['getSize'];
flush: FileSystemSyncAccessHandle['flush'];
};

export async function createOPFSAccess(
Expand Down

0 comments on commit aee587b

Please sign in to comment.