Skip to content

The Imports type in index.d.ts of @assemblyscript/loader is broken. #1507

Closed
@bemafred

Description

@bemafred

The problem; the type of env is not Record<string,unknown>.

/** WebAssembly imports with an optional env object and two levels of nesting. */
export type Imports = {
   [key: string]: Record<string,unknown>;
   env?: {
      memory?: WebAssembly.Memory;
      table?: WebAssembly.Table;
      seed?(): number;
      abort?(msg: number, file: number, line: number, column: number): void;
      trace?(msg: number, numArgs?: number, ...args: number[]): void;
   };
};

A suggestion; make [key:string] type any as well as Record<string,unkown> like the code below.

/** WebAssembly imports with an optional env object and two levels of nesting. */
export type Imports = {
   [key: string]: Record<string,unknown> | any;
   env?: {
      memory?: WebAssembly.Memory;
      table?: WebAssembly.Table;
      seed?(): number;
      abort?(msg: number, file: number, line: number, column: number): void;
      trace?(msg: number, numArgs?: number, ...args: number[]): void;
   };
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions