Skip to content

SearchOptions.facetFilters type is too restrictive #1383

Description

@eliasnorrby

As per the docs, SearchOptions.facetFilters can be a list with elements being a list of string | string[]:

index.search('',{facetFilters: [["author:Stephen King","genre:Horror"],"publisher:Penguin"]});

The currently exported type, however, requires all elements to be of the same type, i.e. either string or string[]:

 readonly facetFilters?: string|readonlystring[]|ReadonlyArray<readonlystring[]>;

Attempting to call client.search with an array of mixed contents results in this error:

errorTS2322: Type'(string | string[])[]'isnotassignabletotype'string | readonly string[] | readonly (readonly string[])[]'.Type'(string | string[])[]'isnotassignabletotype'readonly (readonly string[])[]'.Type'string | string[]'isnotassignabletotype'readonly string[]'.Type'string'isnotassignabletotype'readonly string[]'.{facetFilters: ['abc:123',['def:456','one:two']]},

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