Skip to content

Property 'id' does not exist on type 'Record<string, unknown> | Record<string, unknown>[]'. #1306

Description

@avevlad

Description

Version: "@gitbeaker/node": "^25.2.0"

Error:

Property 'id' does not exist on type 'Record<string, unknown> | Record<string, unknown>[]'.
  Property 'id' does not exist on type 'Record<string, unknown>[]'.ts(2339)

What am I doing wrong?

image

import { Gitlab } from "@gitbeaker/node"; // All Resources

let GITLAB_PROJECT_ID = process.env.GITLAB_PROJECT_ID;

if (!GITLAB_PROJECT_ID) {
  throw new Error("set env GITLAB_PROJECT_ID");
}

const api = new Gitlab({
  host: "https://git.stage.com",
  token: process.env.GITLAB_ACCESS_TOKEN,
});

(async () => {
  let project = await api.Projects.show(GITLAB_PROJECT_ID);
  console.log("project", project);
  if (!project) {
    throw Error("Project not found");
  }
  let ppl = await api.Pipelines.all(project.id);
  // console.log(ppl.length);
})();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions