Skip to content

IndexApi.replace() seems to have wrong signature #4

@Choppel

Description

@Choppel

1.) Wrong type definition

The autocomplete from my IDE (PHPStorm) suggests the following:

grafik

However, the data returned looks like this:

{
  _index: 'db',
  _id: 8865561979561969000,
  created: false,
  result: 'updated',
  status: 200
}

The attribute found from the type definition is not present in the data and the attribute status from the data is not present in the type definition.

2.) Missing type definition
When the query does not succeed the returned data is something like this:

{
  error: {
    type: "table 'main' absent, or does not support INSERT",
    index: 'main'
  },
  status: 409
}

The return type of the type definition does not mention this. AFAICT the method need to return Promise<SuccessResponse | ErrorResponse> and not only Promise<SuccessResponse>.

This may occur on more than just this method. At least IndexApi.insert() seems to have the same problem.

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