Skip to content

docs: packages/client/README.md calls approvals.approve(requestId, 'LGTM') — the second parameter is a decision object, so the npm front page fails with TS2559 #16210

Description

@os-litant

Found while working #16142 in the same code fence; a different defect class (wrong argument shape for a method that exists, vs. methods that no longer exist), so deliberately left untouched by that PR. Recorded only — not claimed, no assignee.

Where

packages/client/README.md, in the "Available Namespaces / Complete API Coverage" tour, on origin/main @ a7cce55038c:

// Approvals (approval is a flow node — decisions are keyed by request id)
await client.approvals.approve(requestId, 'LGTM');
await client.approvals.reject(requestId, 'Incomplete');

Why it is wrong

packages/client/src/index.ts:4686 and :4699:

approve: async (requestId: string, decision?: { actorId?: string; comment?: string; attachments?: string[] }): Promise<ApprovalDecisionResult> => {
reject:  async (requestId: string, decision?: { actorId?: string; comment?: string; attachments?: string[] }): Promise<ApprovalDecisionResult> => {

The second parameter is a decision object, not a comment string. Type-checked against the package's own published declarations (packages/client/dist/index.d.ts, built from a7cce55038c), both README lines fail:

error TS2559: Type '"LGTM"' has no properties in common with type '{ actorId?: string | undefined; comment?: string | undefined; attachments?: string[] | undefined; }'.
error TS2559: Type '"Incomplete"' has no properties in common with type '{ actorId?: string | undefined; comment?: string | undefined; attachments?: string[] | undefined; }'.

The docs site already has the correct spelling — content/docs/api/client-sdk.mdx writes client.approvals.approve(requestId, { comment: 'Looks good' }). As with #16142, the asymmetry is that the README shipping inside the package is the copy left behind.

A JavaScript reader gets no type error and a silently dropped comment: the string is sent as the request body where the route expects the decision object's fields.

Why it is worth a card

Same reason as #16142 and not a duplicate of it: packages/client/package.json declares files: ["dist", "README.md", "CHANGELOG.md"], so this is the npm front page of @objectstack/client. It is also ungraded — every call in this fence sits in check:published-readme-exports's NOT read bucket, measured and filed as #16209.

Executable criterion

Type-check the two lines against packages/client/dist/index.d.ts after pnpm --filter '@objectstack/client...' build: they fail TS2559 today and must compile after the fix. The correct spelling is { comment: 'LGTM' } / { comment: 'Incomplete' }, matching content/docs/api/client-sdk.mdx.

Not in scope for #16142

#16142 is the three client.ai.* methods removed in v17. This is a live method documented with the wrong argument type; triage on #16142 drew that class line explicitly, and this PR keeps it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions