MCPcopy
hub / github.com/date-fns/date-fns / recoverRefs

Function recoverRefs

pkgs/docs/src/json.ts:32–54  ·  view source on GitHub ↗
(refl: DeclarationReflection)

Source from the content-addressed store, hash-verified

30 const refMap = typesMap(reflection);
31
32 function recoverRefs(refl: DeclarationReflection) {
33 const refs = extractRefs(refl);
34
35 const missingRefs = new Set<number>();
36 refs.forEach((id) => {
37 if (refMap[id]) return;
38 missingRefs.add(id);
39 });
40
41 missingRefs.forEach((id) => {
42 const missingRef = map[id];
43 if (!missingRef) return;
44
45 recoveredRefs.add(missingRef);
46
47 // Update map, to avoid adding types included with the missing ref
48 refMap[id] = missingRef;
49 Object.assign(refMap, typesMap(missingRef));
50
51 // Recursively recover missing refs
52 recoverRefs(missingRef);
53 });
54 }
55
56 recoverRefs(reflection);
57

Callers 1

readRefsFromJSONFunction · 0.85

Calls 2

extractRefsFunction · 0.85
typesMapFunction · 0.85

Tested by

no test coverage detected