Skip to content

IGroupSharingOptions interface for the getUserMembership method #1198

@hogpilot

Description

@hogpilot

Describe the bug

I can’t figure out why id is required on interface IGroupSharingOptions for the getUserMembership function? id doesn't appear to be used anywhere in the code logic, and it doesn't make sense to me in the context of this method. Any insight is welcome.

The following code snippet results in a TypeScript error:

Argument of type '{ groupId: string; authentication: ArcGISIdentityManager; }' is not assignable to parameter of type 'IGroupSharingOptions'. Property 'id' is missing in type '{ groupId: string; authentication: ArcGISIdentityManager; }' but required in type 'IGroupSharingOptions'.

import {
  getUserMembership,
  IGroupSharingOptions,
} from "@esri/arcgis-rest-portal";

export const getUserMembership_without_id = ({
  groupId,
  authentication,
}: IGroupSharingOptions) => {
  return getUserMembership({
    // The TypeScript error is here and described above
    groupId,
    authentication,
  });
};

If id is indeed required, then what is it in the context of this getUserMembership function? The docs say:

Unique identifier for the item. Inherited from ISharingOptions.id

However, my understanding is that getUserMembership is talking about a group (and thus groupId) and not an item.

Get the User Membership for a particular group. Use this if all you have is the groupId. If you have the group object, check the userMembership.memberType property instead of calling this method.

Reproduction

// repro.ts

import {
  getUserMembership,
  IGroupSharingOptions,
} from "@esri/arcgis-rest-portal"; // version 4.5.0

export const getUserMembership_without_id = ({
  groupId,
  authentication,
}: IGroupSharingOptions) => {
  return getUserMembership({
    // The TypeScript error is here and described above
    groupId,
    authentication,
  });
};

Logs

Argument of type '{ groupId: string; authentication: ArcGISIdentityManager; }' is not assignable to parameter of type 'IGroupSharingOptions'. Property 'id' is missing in type '{ groupId: string; authentication: ArcGISIdentityManager; }' but required in type 'IGroupSharingOptions'.

System Info

ArcGIS REST JS version: 4.5.0

  System:
    OS: Linux 5.10 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12800H
    Memory: 22.09 GB / 24.80 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 23.7.0 - ~/.nvm/versions/node/v23.7.0/bin/node
    npm: 10.9.2 - ~/.nvm/versions/node/v23.7.0/bin/npm

Additional Information

No response

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