vercel / vercel/sdk

`getProjects` returns broken union type.

Open
#320 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
160
Forks
42
Avg merge
19h 36m
Merged PRs (30d)
16

Description

Reproduction on 1.28.6:

const vercel = new Vercel({
  bearerToken: process.env.VERCEL_TOKEN,
});

const result = await vercel.projects.getProjects({
  limit: MAX_PROJECTS,
});

if (result.pagination.next) {
//         ~~~~~~~~~^ [2339]
  throw new Error(`There's more than ${MAX_PROJECTS} projects`);
}

Error:

Diagnostics:
1. ts: Property 'pagination' does not exist on type 'GetProjectsResponseBody'.
     Property 'pagination' does not exist on type 'GetProjectsResponseBody1[]'. [2339]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the projects.getProjects entry point and inspect the GetProjectsResponseBody type used for its response. Reproduce the TypeScript diagnostic with the example request, then trace how the response union is generated or declared. Done means the response exposes pagination for this successful call without introducing an invalid array alternative.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.