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
Conventions that aren't lint-enforced. If you're writing code in this repo, follow these.
4
+
5
+
## Type identifiers
6
+
7
+
-**Don't use TS's `Record<K, V>` utility type.** Use `{ [k: K]: V }` directly.
8
+
9
+
Reason: typegres exports its own `Record` class (the pg composite/row type), and `Record<K, V>` as a type position resolves to TS's global utility — they're not the same shape, and the visual collision causes confusion. ESLint can't distinguish the two reliably (it's identifier-name-based, not type-aware), so this is a convention rather than a lint rule.
10
+
11
+
```ts
12
+
// Don't:
13
+
const headers:Record<string, string> = {};
14
+
15
+
// Do:
16
+
const headers: { [k:string]:string } = {};
17
+
```
18
+
19
+
Using the typegres `Record` class as a type (e.g. `Record<O, 1>` as a return of `scalar()`) is fine — that's the intended use of the exported class.
message: "Don't use @expose.unchecked — it skips RPC arg validation. Use @expose(zSchema) instead. If the method's signature is genuinely inexpressible in zod (or this is a test fixture), add `// eslint-disable-next-line no-restricted-syntax -- <reason>`.",
0 commit comments