assemblyscript icon indicating copy to clipboard operation
assemblyscript copied to clipboard

`TypeError: internref expected` when map is passed to a function

Open paciops opened this issue 2 years ago • 1 comments

Bug description

Error TypeError: internref expected is raised by __lowerInternref when a Map is passed to a function

Steps to reproduce

create a .ts file with

export function mapError(map: Map<i32, String>): void {
  console.log(`Has one? ${map.has(1)}`);
}

compile with

asc assembly/index.ts --target debug && asc assembly/index.ts --target release

in a js file

import { mapError } from "../build/debug.js";
mapError(new Map())

AssemblyScript version

0.27.13

paciops avatar Oct 16 '23 15:10 paciops

Bindings for Map and Set doesn't support yet. Here a WIP pr which partially fix that https://github.com/AssemblyScript/assemblyscript/pull/2340. In the meantime, it's best to avoid these types for external exports

MaxGraey avatar Oct 16 '23 16:10 MaxGraey