We cannot assume that module name is referenced at index `i` in containing source file because we could be calling you with only few module names from the source file. https://github.com/microsoft/TypeScript/blob/main/src/compiler/program.ts#L1571 shows that case _Originally posted by @sheetalkamat in https://github.com/microsoft/TypeScript/pull/45884#r825151963_