Missing Eager Load (ARCH3051)
Ce contenu n’est pas encore disponible dans votre langue.
Key typescript.orm.missing-eager-load · Severity warning · Category orm
When you traverse related data from a query result without declaring eager loading (Include/with/relations), each access triggers a separate query. Eager loading is the canonical N+1 prevention.
Incorrect
Section titled “Incorrect”const posts = await postRepo.find();const titles = posts.map(p => `${p.title} by ${p.author.name}`); // author lazyCorrect
Section titled “Correct”const posts = await postRepo.find({ relations: { author: true } });const titles = posts.map(p => `${p.title} by ${p.author.name}`);Eager-load the relation explicitly in the query with relations/include.