Skip to content

Commit

Permalink
Fixed types
Browse files Browse the repository at this point in the history
  • Loading branch information
james-pre committed Jul 25, 2024
1 parent 502bfec commit c4a91a6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/backends/port/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import { InMemory } from '../memory.js';
import type { Backend } from '../backend.js';
import * as RPC from './rpc.js';

type FileMethods = ExtractProperties<File, (...args: any[]) => Promise<any>>;
type FileMethods = Omit<ExtractProperties<File, (...args: any[]) => Promise<any>>, typeof Symbol.asyncDispose>;
type FileMethod = keyof FileMethods;
interface FileRequest<TMethod extends FileMethod = FileMethod> extends RPC.Request {
fd: number;
scope: 'file';
method: TMethod;
args: Parameters<FileMethods[TMethod]>;
}

Expand Down Expand Up @@ -130,6 +131,7 @@ type FSMethods = ExtractProperties<FileSystem, (...args: any[]) => Promise<any>
type FSMethod = keyof FSMethods;
interface FSRequest<TMethod extends FSMethod = FSMethod> extends RPC.Request {
scope: 'fs';
method: TMethod;
args: Parameters<FSMethods[TMethod]>;
}

Expand Down Expand Up @@ -251,7 +253,6 @@ async function handleRequest(port: RPC.Port, fs: FileSystem, request: FileOrFSRe
if (!descriptors.has(fd)) {
throw new ErrnoError(Errno.EBADF);
}
// @ts-expect-error 2556
value = await descriptors.get(fd)![method](...args);

Check failure on line 256 in src/backends/port/fs.ts

View workflow job for this annotation

GitHub Actions / Ubuntu / CI

A spread argument must either have a tuple type or be passed to a rest parameter.

Check failure on line 256 in src/backends/port/fs.ts

View workflow job for this annotation

GitHub Actions / Windows / CI

A spread argument must either have a tuple type or be passed to a rest parameter.

Check failure on line 256 in src/backends/port/fs.ts

View workflow job for this annotation

GitHub Actions / MacOS / CI

A spread argument must either have a tuple type or be passed to a rest parameter.
if (method == 'close') {
descriptors.delete(fd);
Expand Down

0 comments on commit c4a91a6

Please sign in to comment.