question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

_count not working with typescript

See original GitHub issue

Bug description

The new introduced _count property does not work with the generated Typescript

How to reproduce

This is a portion of the schema:

model Contratto {
    id Int @id @default(autoincrement()) @map("id")

    dataInizio DateTime @map("data_inizio")
    dataFine   DateTime @map("data_fine")

    dataFirmaContratto     DateTime? @map("data_firma_contratto")
    dataChiusuraAnticipata DateTime? @map("data_chiusura_anticipata")

    checkout Float?   @map("checkout")
    cauzione Float?   @map("cauzione")
    tipoRata TipoRata @map("tipo_rata")

    idTariffa Int     @map("id_tariffa")
    tariffa   Tariffa @relation(fields: [idTariffa], references: [id])

    idTipoContratto Int           @map("id_tipo_contratto")
    tipoContratto   TipoContratto @relation(fields: [idTipoContratto], references: [id])

    idQuietanziante Int           @map("id_quietanziante")
    quietanziante   Quietanziante @relation(fields: [idQuietanziante], references: [id])

    note String? @map("note")

    contrattiSuOspite ContrattoSuOspite[]

    bollette Bolletta[]
    @@map("contratto")
}

This is what I have if I want to get the number of “bollette” of a contract:

image

Expected behavior

I would expect to be able to use it, if _count is actually what I think it is.

Environment & setup

  • OS:Ubuntu 20
  • Database: Postgres
  • Node.js version: 15
  • Prisma version: 2.21.2

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gmannocommented, May 25, 2021

Works for me too. Thanks for the support.

1reaction
euberdevelopercommented, May 16, 2021

I did not add selectRelationCount, thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

typescript error with Property 'counter' does not exist on type ...
Hi I have a working example in js and am trying to port it over to tsx but the error I see is....
Read more >
MySQL COUNT() Function - W3Schools
The COUNT() function returns the number of records returned by a select query. Note: NULL values are not counted. Syntax. COUNT(expression). Parameter Values ......
Read more >
column-count - CSS: Cascading Style Sheets - MDN Web Docs
The column-count CSS property breaks an element's content into the specified number of columns.
Read more >
TypeScript Contribution Diary: Pretty Error Counts - Medium
I've started making contributions to TypeScript, working my way up from small error reporting nitpicks to (hopefully!)
Read more >
Documentation - Everyday Types - TypeScript
In this chapter, we'll cover some of the most common types of values you'll find in JavaScript code, and explain the corresponding ways...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found