Describe the bug
Steps to reproduce
- Upgrade
@loopback/repository from 6.1.5 to 8.0.2 (other LoopBack packages remain at compatible versions).
- Build the project with TypeScript strict mode enabled.
Current behavior
TypeScript compilation fails with:
node_modules/@loopback/repository/src/relations/has-many/has-many-through.inclusion-resolver.ts:255:36 - error TS2339: Property 'toString' does not exist on type 'NonNullable<(Target & TargetRelations)[Extract<keyof Target, string>]>'.
255 targetEntity[targetKey]?.toString() ?? targetEntity[targetKey],
node_modules/@loopback/repository/src/relations/has-many/has-many-through.inclusion-resolver.ts:269:35 - error TS2339: Property 'toString' does not exist on type 'NonNullable<(Through & ThroughRelations)[Extract<keyof Through, string>]>'.
269 x => x[throughKeyTo]?.toString() ?? x[throughKeyTo],
### Logs
```shell
```
### Additional information
_No response_
### Reproduction
import {Entity, model, property, hasMany} from '@loopback/repository'; @model() export class Category extends Entity { @property({id: true}) id: number; @hasMany(() => Product, {through: {model: () => CategoryProduct}}) products?: Product[]; } @model() export class Product extends Entity { @property({id: true}) id: number; } @model() export class CategoryProduct extends Entity { @property() categoryId: number; @property() productId: number; }