该报错通常是由于使用了Angular的早期版本造成的。解决方法是更新Angular版本或使用以下代码替换createNamedArrayType:
const createNamedArrayType = function (name: string, size: number) { var struct = function () {}; struct.prototype = Object.create(Array.prototype); struct.prototype.constructor = struct; Object.defineProperty(struct.prototype, 'name', { value: name }); Object.defineProperty(struct.prototype, 'size', { value: size }); return struct; };
替换后以上代码即可解决该报错。