I read https://github.com/AssemblyScript/assemblyscript/issues/369, but I'm not sure how to do it.
I have
assert(s.width === 60, 's.width is not 60, got' + s.width)
and the compiler says
ERROR AS200: Conversion from type 'f64' to '~lib/string/String' requires an explicit cast.
assert(s.width === 60, 's.width is not 60, got' + s.width)
Is it possible?
Ok, found a workaround:
const a = new Array<f64>(1)
a.push(s.width)
assert(s.width === 60, 's.width is not 60, got ' + a.toString())
Currently you should explicitly call toString() method
@MaxGraey Ah, that indeed works, but I got confused by my editor showing an error:

So I also was trying new Number(s.width), but that constructor doesn't take an argument. Is there some other way to do it without TS having an error?
You could fixed this by adding this to your file:
declare global {
interface Number {
toString(): string;
}
}
@dcodeIO It seems we need wrap our definitions to global namespace
I tried to put in my code, and got:
ERROR TS1109: Expression expected.
interface Number {
~~~~~~~~~
in src/as/glas/index.ts(8,1)
As a workaround, what worked was placing
interface Number {
toString(): string
}
in a sibling .d.ts file.
Yes,it better place in separate d.ts file
I'm guessing declare in a .ts file isn't supported yet by the compiler?
@MaxGraey Hello! Should the toString be added to the standard library types for numbers so users don't have to do it?
I haven't see any problem with master: https://webassembly.studio/?f=7eteo29co4o