Skip to content
This repository has been archived by the owner on Jan 14, 2021. It is now read-only.

Wrong jsDocs annotations for create and delete #726

Closed
Zeko369 opened this issue Jun 14, 2020 · 1 comment · Fixed by prisma/prisma#2842
Closed

Wrong jsDocs annotations for create and delete #726

Zeko369 opened this issue Jun 14, 2020 · 1 comment · Fixed by prisma/prisma#2842
Labels
bug/2-confirmed We have confirmed that this is a bug. kind/bug A reported bug. tech/typescript Issue for tech TypeScript.
Milestone

Comments

@Zeko369
Copy link

Zeko369 commented Jun 14, 2020

Bug description

Wrong jsDocs annotations

image

How to reproduce

  • Clone blitz store example
  • Run yarn blitz db migrate
  • Go to generated prisma file and check description

Expected behavior

The screenshot above should have

const product = await ...

instad of

const user = await ...

Prisma information

generator client {
  provider = "prisma-client-js"
}


// --------------------------------------

model User {
  id      Int      @default(autoincrement()) @id
  email   String   @unique
  name    String?
  role    String?
  storeId Int?
}

model Product {
  id          Int      @default(autoincrement()) @id
  handle      String   @unique
  name        String?
  description String?
  price       Int?
}

Environment & setup

  • OS: MacOS
  • Database: SQLite
  • Prisma version: 2.0.0
  • Node.js version: 12.16.1
@janpio janpio transferred this issue from prisma/prisma Jun 14, 2020
@janpio janpio changed the title Prisma generate - wrong jsDocs annotations Wrong jsDocs annotations for create and delete Jun 14, 2020
@janpio janpio added bug/2-confirmed We have confirmed that this is a bug. kind/bug A reported bug. labels Jun 14, 2020
@janpio janpio added this to the 2.1.0 milestone Jun 14, 2020
@janpio
Copy link
Member

janpio commented Jun 14, 2020

I can confirm this for create and delete in a plain Prisma project:

...

  /**
   * Create a Customer.
   * @param {CustomerCreateArgs} args - Arguments to create a Customer.
   * @example
   * // Create one Customer
   * const user = await prisma.customer.create({
   *   data: {
   *     // ... data to create a Customer
   *   }
   * })
   * 
  **/
  create<T extends CustomerCreateArgs>(
    args: Subset<T, CustomerCreateArgs>
  ): CheckSelect<T, CustomerClient<Customer>, CustomerClient<CustomerGetPayload<T>>>
  /**
   * Delete a Customer.
   * @param {CustomerDeleteArgs} args - Arguments to delete one Customer.
   * @example
   * // Delete one Customer
   * const user = await prisma.customer.delete({
   *   where: {
   *     // ... filter to delete one Customer
   *   }
   * })
   * 
  **/
  delete<T extends CustomerDeleteArgs>(
    args: Subset<T, CustomerDeleteArgs>
  ): CheckSelect<T, CustomerClient<Customer>, CustomerClient<CustomerGetPayload<T>>>

...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug/2-confirmed We have confirmed that this is a bug. kind/bug A reported bug. tech/typescript Issue for tech TypeScript.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants