Skip to content

Property 'belongsToMany' does not exist on type 'typeof ... #8

@tintin10q

Description

@tintin10q

Thank you for creating this package!

Reproduction

I created a simple model but the .belongsToMany gives me the error Property 'belongsToMany' does not exist on type 'typeof ...

Steps to reproduce the behavior

  1. Install piniaorm
  2. Create a model (group.ts)
import { Model } from "pinia-orm";

import GroupMember from "./GroupMember";
import Member from "./Member";

export default class Group extends Model {
  static entity = "Group";

  static fields() {
    return {
      id: this.uid(),
      title: this.string(""),
      description: this.string(""),
      members: this.belongsToMany(Member, GroupMember, "group_id", "member_id"),
    };
  }
}
  1. See that your editor (Webstorm in my case) says that belongsToMany does not exist.

Expected behavior

I would expect this.belongsToMany to exist and behave just like the original docs described it. https://vuex-orm.org/guide/model/relationships.html#many-to-many

Actual behavior

It says belongsToMany does not exist.

Additional information

If you didn't implement belongsToMany it might be good to put this in the README.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomersquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions