Skip to content

v4.5 does not provide types for @algolia/autocomplete-core anymore #2850

@slorber

Description

@slorber

Description

In #2831 the dependency on @algolia/autocomplete-core has been moved to devDependencies, but I believe this was the wrong decision.

The DocSearch/react API relies on these types in its API contract.

When the types are unavailable, inference breaks.

Steps to reproduce

In v4.5, params has type any, because TypeScript can't figure out the types since they are not available in node modules anymore:

import type {DocSearchModalProps} from '@docsearch/react';

const navigator: DocSearchModalProps['navigator'] = {
  navigate(params) {
    params.whateverIWant;
  },
};

In v4.4, params has type AutocompleteOptions found in node modules, and we can autocomplete on the params attributes with the IDE

import type {DocSearchModalProps} from '@docsearch/react';

const navigator: DocSearchModalProps['navigator'] = {
  navigate(params) {
    params.state;
  },
};

Expected behavior

Types that are part of the DocSearch React publicly accessible API should be in dependencies (even if they are not directly re-exported, they are still accessible and useful to users).

I suspect this

Environment

"@docsearch/react": "^4.5.3"

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