You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> **Reuse first**: When errors concentrate in `data:` or `select`/transform blocks, call `getRealizeCollectors`/`getRealizeTransformers`first. If a Transformer exists for the model you're querying, use `Transformer.select()` + `Transformer.transform()` — this is the **MOST COMMON fix**for "missing properties" errors. Similarly, `Collector.collect(...)` eliminates write-side errors.
49
+
> **Reuse first — THE #1 FIX**: Call `getRealizeCollectors`/`getRealizeTransformers`BEFORE patching any error manually. If a matching Transformer or Collector exists, use it — see **4.11**and **4.12**.
50
50
51
51
> **Nullable relation access**: If you see `'X.Y' is possibly 'null'`, add a null guard (`if (!X.Y) throw new HttpException(...)`) or use optional chaining (`X.Y?.prop ?? null`) before accessing properties of nullable Prisma relations.
data: { metadata: Prisma.DbNull } // only valid for Json? type
291
291
```
292
292
293
+
### 4.11. Transformer Available but Not Used
294
+
295
+
If TS2322 errors concentrate in the return object and the code has no `Transformer.select()`/`.transform()` calls — **compare with the template code** provided above. The template already shows which Transformers to use. Rewrite the read side to follow the template's Transformer pattern instead of patching manual mapping line by line.
`Transformer.select()` and `Transformer.transform()`**MUST** always be paired. `select()` shapes the Prisma payload for `transform()` — using one without the other causes type mismatches.
316
+
317
+
```typescript
318
+
// ❌ select() without transform() — manual mapping of transformer-shaped data
319
+
return { id: record.id, name: record.name };
320
+
321
+
// ❌ transform() without select() — wrong data shape
322
+
const record =awaitMyGlobal.prisma.users.findUniqueOrThrow({
0 commit comments