CODEBASE: Merge TypeAssertion files (#1922)

This commit is contained in:
catloversg
2025-01-25 02:06:39 +07:00
committed by GitHub
parent f0a0d3095e
commit 9bf408221c
19 changed files with 125 additions and 111 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
/* Generic Reviver, toJSON, and fromJSON functions used for saving and loading objects */
import { ObjectValidator } from "./Validator";
import { JSONMap, JSONSet } from "../Types/Jsonable";
import { objectAssert } from "./helpers/typeAssertion";
import { assertObject } from "./TypeAssertion";
type JsonableClass = (new () => { toJSON: () => IReviverValue }) & {
fromJSON: (value: IReviverValue) => unknown;
@@ -58,7 +58,7 @@ export function Generic_fromJSON<T extends Record<string, any>>(
data: unknown,
keys?: readonly (keyof T)[],
): T {
objectAssert(data);
assertObject(data);
const obj = new ctor();
// If keys were provided, just load the provided keys (if they are in the data)
if (keys) {