Sometimes, under less-than-clean npm conditions, npm installs multiple isolated typeorm packages, and nestjs-paginate ends up using a different one from the main build. In that case, all the typeorm related instanceof checks (3) fail:
repo instanceof Repository
fails, because the user passed in a Repository from theirtypeorm, call it typeorm-a, while nestjs-paginate has imported Repository from typeorm-b. I can submit a PR to convert these 3 instanceof checks to something like:
function isRepository(repo: unknown): repo is Repository {
if (repo instanceof Repository) return true;
try {
if (Object.getPrototype(repo).constructor.name === "Repository")
return true;
return !('connection' in repo) && 'manager' in repo,
} catch {
return false
}
}
Sometimes, under less-than-clean
npm
conditions,npm
installs multiple isolatedtypeorm
packages, andnestjs-paginate
ends up using a different one from the main build. In that case, all thetypeorm
relatedinstanceof
checks (3) fail:fails, because the user passed in a
Repository
from theirtypeorm
, call ittypeorm-a
, whilenestjs-paginate
has importedRepository
fromtypeorm-b
. I can submit a PR to convert these 3instanceof
checks to something like: