Skip to content

Return type of MemberApi.getMany() is not narrowed correctly when includeLeft: undefined is specified #1256

@achou11

Description

@achou11

When calling something like project.$member.getMany({ includeLeft: undefined }), the return type is ActiveMemberInfo[] | MemberInfo[], as opposed to just ActiveMemberInfo[].

This snippet is enough to see the issue (as of @comapeo/core@7):

import { MapeoManager } from "@comapeo/core";

async function test() {
  // @ts-expect-error
  const manager = new MapeoManager();

  const projectId = await manager.createProject();

  const project = await manager.getProject(projectId);

  // Has incorrect type
  const members = await project.$member.getMany({
    includeLeft: undefined,
  });
  //    ^?
}

Example in Typescript playground

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