Skip to content

TypeScript error: Property 'toString' does not exist in has-many-through.inclusion-resolver.ts after upgrading to @loopback/repository@8.0.2 #11123

Description

@Doni1231

Describe the bug

Steps to reproduce

  1. Upgrade @loopback/repository from 6.1.5 to 8.0.2 (other LoopBack packages remain at compatible versions).
  2. 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; }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions