Skip to content

Incorrect TypeScript types for contacts.search query #458

@jaska120

Description

@jaska120

The following was considered valid with previous library version. Also, it works correctly with the new 6.0.0 library version, if the types are supressed, as in the example:

  const result = await intercom.contacts.search({
    query: {
      operator: MultipleFilterSearchRequest.Operator.Or,
      value: [
        {
          field: 'external_id',
          operator: SingleFilterSearchRequest.Operator.Equals,
          value: 'some_external_id',
        },
        {
          // @ts-expect-error TODO remove this once the types in the library are correct, as it works this way.
          operator: MultipleFilterSearchRequest.Operator.And,
          // @ts-expect-error TODO remove this once the types in the library are correct, as it works this way.
          value: [
            {
              field: 'role',
              operator: SingleFilterSearchRequest.Operator.Equals,
              value: 'user',
            },
            {
              field: 'email',
              operator: SingleFilterSearchRequest.Operator.Equals,
              value: `some_email`,
            },
          ],
        },
      ],
    },
  });

The types don't seem to work correctly around the MultipleFilterSearchRequest variant.

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