Closed timvandam closed 7 months ago
That's fixed
Hello @marcj , it seems that I'm getting a similar issue in the latest master
, here's how it can be reproduced at development repo:
packages/type/tests/recursive-union.spec.ts
:
import { test } from '@jest/globals';
import {cast} from "../src/serializer-facade";
type JSONValue = null | boolean | number | string | JSONObject | JSONArray;
type JSONArray = JSONValue[];
export type JSONObject = {
[k: string]: JSONValue;
};
test('complex recursive union type does not cause stack size exceeding', () => {
const user = cast<JSONObject>({ username: 'Peter' });
});
Then execute npm run test packages/type/tests/recursive-union.spec.ts
.
@alpharder good catch, thanks. indeed, some circular references weren't detected correctly. I've refactored the code to move the circular reference solver into the typeguard/serializer API itself so the various type templates don't have to take care of that. This should now support much more circular references, if not all. I've added your JSONValue type to our test suite to make sure it keeps working.
fixed in https://github.com/deepkit/deepkit-framework/commit/5f6bd124aaf9c546014b81dbded8110312f4e819
@marcj wow, that change is massive, thank you for the quick fix! Looking forward for the next release.
@alpharder released in 1.0.1-alpha.124
Running
resolveReceiveType
eventually causes a V8 OOM