Open
Description
Simple example:
class A<T> {
foo<U extends ArrayLike<T> = Array<T>>(a: U): U {
return a;
}
}
const a = new A<string>();
const r = a.foo([]); // `r` should infer as Array<string> but it deduced as `Array<usize>` instead
// a.foo<string[]>([]) // <- works
export function check(): bool {
return r instanceof Array<string>; // will return `false` instead `true`
}
AssemblyScript has a pessimistic rule. When empty array literal can't be inferred value type it presents this as usize
instead any
(TS-way). But this is not that situation.