diff --git a/std/assembly/array.ts b/std/assembly/array.ts index 27ff361e30..d82a0da1ff 100644 --- a/std/assembly/array.ts +++ b/std/assembly/array.ts @@ -6,7 +6,7 @@ import { COMPARATOR, SORT } from "./util/sort"; import { REVERSE } from "./util/bytes"; import { joinBooleanArray, joinIntegerArray, joinFloatArray, joinStringArray, joinReferenceArray } from "./util/string"; import { idof, isArray as builtin_isArray } from "./builtins"; -import { E_INDEXOUTOFRANGE, E_INVALIDLENGTH, E_ILLEGALGENTYPE, E_EMPTYARRAY, E_HOLEYARRAY } from "./util/error"; +import { E_INDEXOUTOFRANGE, E_INVALIDLENGTH, E_EMPTYARRAY, E_HOLEYARRAY } from "./util/error"; // @ts-ignore: decorator @inline @lazy const MIN_SIZE: usize = 8; @@ -494,7 +494,7 @@ export class Array { flat(): T { if (!isArray()) { - throw new TypeError(E_ILLEGALGENTYPE); + ERROR("Cannot call flat() on Array where T is not an Array."); } // Get the length and data start values var ptr = this.dataStart; diff --git a/std/assembly/util/error.ts b/std/assembly/util/error.ts index f9a0f83d7a..ba3425265b 100644 --- a/std/assembly/util/error.ts +++ b/std/assembly/util/error.ts @@ -13,10 +13,6 @@ export const E_VALUEOUTOFRANGE: string = "Value out of range"; @lazy @inline export const E_INVALIDLENGTH: string = "Invalid length"; -// @ts-ignore: decorator -@lazy @inline -export const E_ILLEGALGENTYPE: string = "Illegal generic type"; - // @ts-ignore: decorator @lazy @inline export const E_EMPTYARRAY: string = "Array is empty";