I try to view the document of typeorm (for v0.3 now). But the Nest.js application is based on v0.2.
The document said that I can use find method with find-option:
const questions = await questionRepository.find({
relations: {
categories: true,
},
})
But when I try, the TypeScript tell me that the relations' type is string[]. So I change it to:
const questions = await questionRepository.find({
relations: ['categories']
})
But raise an error:
Relation "categories" was not found; please check if it is correct and really exists in your entity.
I do not want to use createQueryBuilder because it uses the string and it is hard to deal with: Sometimes the original entity changes its name but TypeScript will never raise an error...
So can I use the relations on v0.2? I cannot find anything useful for this version.