Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Provide the generic type on raw/select query calls
Pass the expected row shape as a generic to raw query/select methods so the result is typed instead of any/unknown.
Bad example
| 1 | const rows = await this.db.select(query); |
Explanation (EN)
An untyped raw result permits unchecked field access and hides the intended row contract.
Objašnjenje (HR)
Good example
| 1 | const rows = await this.db.select<{ profileId: number }>(query); |
Explanation (EN)
Objašnjenje (HR)
Notes (EN)
Describe the actual driver row representation, including nullable joins, aliases and numeric/date conversion policy, when using a typed raw-query API.
Exceptions / Tradeoffs (EN)
A generic does not validate returned rows. Driver configuration or schema drift may require runtime parsing; large database integers can be strings to preserve precision.