pinia-orm icon indicating copy to clipboard operation
pinia-orm copied to clipboard

Decorators with typescript - Value of type 'typeof HasMany' is not callable. Did you mean to include 'new'?

Open nowrap opened this issue 1 year ago • 2 comments

Hello,

i am trying to use the decorators for relationships in a typescript vue project. But i am getting an error:

Value of type 'typeof HasMany' is not callable. Did you mean to include 'new'?

@HasMany(() => MoodPercentage, 'moodId') declare percentages: MoodPercentage[]

Using the static field variant seems to work:

  static fields () {
    return {
      percentages: this.hasMany(MoodPercentage, 'moodId'),
    }
  }

The typescript compiler options are:

"useDefineForClassFields": true,
"moduleResolution": "bundler",
"experimentalDecorators": true

Maybe someone has a suggestion for me

Regards nowrap

nowrap avatar Apr 23 '24 14:04 nowrap

Please provide a reproduction. 🙏 This are not enough information to see what the problem is.

CodeDredd avatar May 06 '24 09:05 CodeDredd

Sure, I'd love to, but it's more likely to be next week

nowrap avatar May 06 '24 16:05 nowrap

I think this is resolved. Please reopen it if not. Thanks ❤️

CodeDredd avatar Jul 22 '24 16:07 CodeDredd