@@ -20,6 +20,11 @@ or reword them. Translate Go `//` comments to JSDoc (`/** */`) format for
2020exported symbols, but keep the full content including multi-paragraph
2121explanations and examples.
2222
23+ **Do not add documentation beyond what the Go SDK has.** If a Go type or
24+ function has no doc comment, the TypeScript version should not have one either.
25+ Do not invent explanations, add `@packageDocumentation` summaries, or expand
26+ on what Go provides.
27+
2328```go
2429// OutOfRange means the operation was attempted past the valid range.
2530// E.g., seeking or reading past end of file.
@@ -52,3 +57,54 @@ TypeScript:
5257
5358Each Go package that is separately importable should be a separate directory
5459with its own `index.ts` and a corresponding subpath export in `package.json`.
60+
61+ ## Naming
62+
63+ Names in the TypeScript implementation must be idiomatic TypeScript. Do not
64+ reference the source language in variable, function, or type names.
65+
66+ ```typescript
67+ // Good — describes what the schema does.
68+ const nullishString = z.string().nullish().transform(v => v ?? '');
69+
70+ // Bad — references Go in the name.
71+ const goString = z.string().nullish().transform(v => v ?? '');
72+ ```
73+
74+ ## Tests
75+
76+ Port **all** test cases from the Go SDK. Do not selectively skip tests. When a
77+ Go test case cannot be directly ported (e.g. because of a language difference
78+ like `json.RawMessage` vs already-parsed JSON), explain the omission to the
79+ user and get confirmation before skipping.
80+
81+ Use the same test structure as the Go SDK. Go table-driven tests map to
82+ Vitest's `it.each`:
83+
84+ ```go
85+ // Go
86+ testCases := []struct{ name string; input int; want int }{
87+ {"positive", 1, 1},
88+ {"zero", 0, 0},
89+ }
90+ for _, tc := range testCases {
91+ t.Run(tc.name, func(t *testing.T) { ... })
92+ }
93+ ```
94+
95+ ```typescript
96+ // TypeScript equivalent
97+ const testCases: {name: string; input: number; want: number}[] = [
98+ {name: 'positive', input: 1, want: 1},
99+ {name: 'zero', input: 0, want: 0},
100+ ];
101+ it.each(testCases)('$name', ({input, want}) => { ... });
102+ ```
103+
104+ ## Deviations from Go
105+
106+ When the TypeScript implementation must differ from Go (e.g. different function
107+ signatures, different input types, skipped tests), **explain the deviation to
108+ the user** before proceeding. Do not silently change behaviour or add comments
109+ in the code about Go differences — keep the codebase clean of porting
110+ artifacts.
0 commit comments