in src/docgen/transpile/transpile.ts [748:778]
protected findSubmodule(type: reflect.Type): reflect.Submodule | undefined {
if (this.submodulesCache.has(type.fqn)) {
return this.submodulesCache.get(type.fqn);
}
let submodule = undefined;
if (type.namespace) {
// if the type is in a submodule, the submodule name is the first
// part of the namespace. we construct the full submodule fqn and search for it.
const submoduleFqn = `${type.assembly.name}.${type.namespace.split('.')[0]}`;
const submodules = type.assembly.submodules.filter(
(s) => s.fqn === submoduleFqn,
);
if (submodules.length > 1) {
// can never happen, but the array data structure forces this handling.
throw new Error(`Found multiple submodulues with fqn ${submoduleFqn}`);
}
if (submodules.length === 0) {
submodule = undefined;
}
// type is inside this submodule.
submodule = submodules[0];
}
this.submodulesCache.set(type.fqn, submodule);
return submodule;
}