import { JSON } from "../.."; import { deserializeArbitraryArray } from "./array/arbitrary"; import { deserializeArrayArray } from "./array/array"; import { deserializeBooleanArray } from "./array/bool"; import { deserializeFloatArray } from "./array/float"; import { deserializeIntegerArray } from "./array/integer"; import { deserializeMapArray } from "./array/map"; import { deserializeObjectArray } from "./array/object"; import { deserializeStringArray } from "./array/string"; // @ts-ignore: Decorator valid here export function deserializeArray(srcStart: usize, srcEnd: usize, dst: usize): T { if (isString>()) { return deserializeStringArray(srcStart, srcEnd, dst); } else if (isBoolean>()) { // @ts-ignore return deserializeBooleanArray(srcStart, srcEnd, dst); } else if (isInteger>()) { // @ts-ignore return deserializeIntegerArray(srcStart, srcEnd, dst); } else if (isFloat>()) { // @ts-ignore return deserializeFloatArray(srcStart, srcEnd, dst); } else if (isArrayLike>()) { // @ts-ignore: type return deserializeArrayArray(srcStart, srcEnd, dst); } else if (isManaged>() || isReference>()) { const type = changetype>>(0); if (type instanceof JSON.Value) { // @ts-ignore: type return deserializeArbitraryArray(srcStart, srcEnd, dst); } else if (type instanceof Map) { // @ts-ignore: type return deserializeMapArray(srcStart, srcEnd, dst); // @ts-ignore: defined by transform } else if (isDefined(type.__DESERIALIZE)) { return deserializeObjectArray(srcStart, srcEnd, dst); } throw new Error("Could not parse array of type " + nameof() + "!"); } else { throw new Error("Could not parse array of type " + nameof() + "!"); } } function isMap(): boolean { let type: T = changetype(0); return type instanceof Map; }