Skip to content

Commit 21cd24f

Browse files
📝 Add docstrings to fix/nested-select-typing
Docstrings generation was requested by @ymc9. * #92 (comment) The following files were modified: * `packages/runtime/src/utils/type-utils.ts` * `packages/runtime/test/typing/verify-typing.ts`
1 parent d9a8c3b commit 21cd24f

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

packages/runtime/src/utils/type-utils.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ export type JsonValue = string | number | boolean | null | JsonObject | JsonArra
4545
export type JsonObject = { [key: string]: JsonValue };
4646
export type JsonArray = Array<JsonValue>;
4747

48+
/**
49+
* Returns an object containing the provided code string as the `code` property.
50+
*
51+
* @param code - The string to assign to the `code` property
52+
* @returns An object with a single `code` property set to the input string
53+
*/
4854
export function call(code: string) {
4955
return { code };
5056
}

packages/runtime/test/typing/verify-typing.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ async function main() {
3030
enums();
3131
}
3232

33+
/**
34+
* Demonstrates various user query operations using the ZenStackClient, including filtering, selecting, omitting, and including nested relations.
35+
*
36+
* Executes and logs results for single and multiple user queries, nested relation selections, computed fields, pagination, ordering, distinct, and cursor-based queries. Also verifies TypeScript type safety for invalid query combinations and field access.
37+
*/
3338
async function find() {
3439
const user1 = await client.user.findFirst({
3540
where: {
@@ -188,6 +193,11 @@ async function find() {
188193
console.log(u.posts[0]?.author?.email);
189194
}
190195

196+
/**
197+
* Demonstrates various create operations for users, profiles, regions, posts, and tags using the ZenStackClient.
198+
*
199+
* This includes single and batch creation, nested relation creation, compound key connections, and many-to-many associations. Also tests error scenarios for required fields and invalid relation usage.
200+
*/
191201
async function create() {
192202
await client.user.create({
193203
// @ts-expect-error email is required

0 commit comments

Comments
 (0)