json-as 0.5.23 → 0.5.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assembly/src/json.ts +3 -4
- package/assembly/src/util.ts +2 -2
- package/package.json +1 -1
- package/transform/package.json +1 -1
package/assembly/src/json.ts
CHANGED
|
@@ -128,7 +128,7 @@ export namespace JSON {
|
|
|
128
128
|
// @ts-ignore
|
|
129
129
|
return data.toString();
|
|
130
130
|
} else {
|
|
131
|
-
throw new Error(`Could not serialize data of type ${nameof<T>()}.
|
|
131
|
+
throw new Error(`Could not serialize data of type ${nameof<T>()}. Make sure to add the correct decorators to classes.`);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
/**
|
|
@@ -165,7 +165,7 @@ export namespace JSON {
|
|
|
165
165
|
return parseBigNum<T>(data);
|
|
166
166
|
} else {
|
|
167
167
|
// @ts-ignore
|
|
168
|
-
throw new Error(`Could not deserialize data ${data} to type ${nameof<T>()}.
|
|
168
|
+
throw new Error(`Could not deserialize data ${data} to type ${nameof<T>()}. Make sure to add the correct decorators to classes.`);
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
// @ts-ignore
|
|
@@ -194,8 +194,7 @@ export namespace JSON {
|
|
|
194
194
|
return parseBigNum<T>(data);
|
|
195
195
|
} else {
|
|
196
196
|
// @ts-ignore
|
|
197
|
-
|
|
198
|
-
throw new Error(`Could not deserialize data ${data} to type ${nameof<T>()}. Invalide data provided.`)
|
|
197
|
+
throw new Error(`Could not deserialize data ${data} to type ${nameof<T>()}. Make sure to add the correct decorators to classes.`)
|
|
199
198
|
}
|
|
200
199
|
}
|
|
201
200
|
}
|
package/assembly/src/util.ts
CHANGED
|
@@ -67,7 +67,7 @@ export function escapeChar(char: string): string {
|
|
|
67
67
|
*/
|
|
68
68
|
export function getArrayDepth<T>(depth: i32 = 1): i32 {
|
|
69
69
|
// @ts-ignore
|
|
70
|
-
if (isArray<T>()) {
|
|
70
|
+
if (!isArray<T>()) {
|
|
71
71
|
return 0;
|
|
72
72
|
// @ts-ignore
|
|
73
73
|
} else if (isArray<valueof<T>>()) {
|
|
@@ -77,4 +77,4 @@ export function getArrayDepth<T>(depth: i32 = 1): i32 {
|
|
|
77
77
|
} else {
|
|
78
78
|
return depth;
|
|
79
79
|
}
|
|
80
|
-
}
|
|
80
|
+
}
|
package/package.json
CHANGED