Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IGroupSharingOptions interface for the getUserMembership method #1198

Open
hogpilot opened this issue Mar 5, 2025 · 0 comments
Open

IGroupSharingOptions interface for the getUserMembership method #1198

hogpilot opened this issue Mar 5, 2025 · 0 comments

Comments

@hogpilot
Copy link
Contributor

hogpilot commented Mar 5, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant