msgraph-typescript-typings icon indicating copy to clipboard operation
msgraph-typescript-typings copied to clipboard

FieldValueSet type does not match documentation

Open BovineEnthusiast opened this issue 4 years ago • 3 comments

The interface for FieldValueSet is defined as follows:

export interface Entity {
    // Read-only.
    id?: string;
}
export interface FieldValueSet extends Entity {}

Meanwhile, in the example and resource description its usage seems to imply that it actually should be defined as follows:

export interface FieldValueSet {
  [key: string]: any
}

If you look at the typed languages (C# or Java) in the example linked above (no typescript example, unfortunately), they use instances of FieldValueSet in a way that matches my proposed interface definition.

Should the interface provided in the TypeScript typings be changed?

BovineEnthusiast avatar May 15 '20 17:05 BovineEnthusiast

FieldValueSet is an opentype where the properties are user defined in SharePoint list items. They cannot be typed ahead of time. The only potentially typed property is ID as specified in Entity.

The interface is correct. You'll need to expect untyped properties on the JavaScript object.

MIchaelMainer avatar May 21 '20 21:05 MIchaelMainer

@MIchaelMainer , the interface is incorrect. The current typing of FieldValueSet only allows 1 optional property "id" and nothing else. While it should allow any user defined property. The proposed type of @BovineEnthusiast is more flexible and does exactly that.

When will this error be fixed?

Geoffrynagy avatar Sep 01 '21 13:09 Geoffrynagy

@Geoffrynagy and @BovineEnthusiast I was incorrect. @nikithauc we need to account for opentypes when we generate for TypeScript.

<EntityType Name="fieldValueSet" BaseType="graph.entity" OpenType="true" />

MIchaelMainer avatar Sep 01 '21 23:09 MIchaelMainer