Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug]: Latest release breaks algoliasearch types #1562

Closed
mrmckeb opened this issue Oct 18, 2024 · 7 comments · Fixed by algolia/api-clients-automation#3988
Closed

[bug]: Latest release breaks algoliasearch types #1562

mrmckeb opened this issue Oct 18, 2024 · 7 comments · Fixed by algolia/api-clients-automation#3988
Assignees
Labels

Comments

@mrmckeb
Copy link

mrmckeb commented Oct 18, 2024

Description

In 5.9.0 (migrating from 5.8.1), types are broken for algoliasearch.

From my quick investigation, the package references types from @algolia/client-search, however this is not a dependency of algoliasearch and causes TypeScript to return any. Other types that were previously accessible, like SearchResponses are no longer available.

algoliasearch(appId: string, apiKey: string, options?: any): any

Client

All

Version

5.9.0

Relevant log output

No response

@mrmckeb mrmckeb added the bug label Oct 18, 2024
@Haroenv
Copy link
Contributor

Haroenv commented Oct 18, 2024

Do you have a specific setup in which this reproduces? There are .d.ts files published and they're registered in the package.json too

@thegnuu
Copy link
Contributor

thegnuu commented Oct 18, 2024

Something changed in the type definitions and somehow this keeps happening in this library even on minor changes which frequently breaks all of our implementations...

Previously the return of algoliasearch(...) was of the type SearchClient.
import { SearchClient, algoliasearch } from 'algoliasearch';

With 5.9.0 this changed to Algoliasearch for some reason, I had to fix all of my imports and usages to this:

import { Algoliasearch, algoliasearch } from 'algoliasearch';

The type SearchClient is still available, but not exported in the packagealgoliasearch just in @algolia/client-search

To me the usage of Algoliasearch and algoliasearch seems a bad idea, separating two different things by a capital letter does not seem to be the best idea IMHO :)

@thegnuu
Copy link
Contributor

thegnuu commented Oct 18, 2024

I just found out that there are other issues appearing after updating:

ModuleDependencyError: export 'Status' (reexported as 'Status') was not found in '@algolia/client-abtesting'

We will revert everything to the previous version for now. This should not happen on minor releases, this breaks the whole semver idea, since those changes seems to be intended and not by accident. We are all happy to migrate stuff if changes are necessary but please let us know about it.

If you need any help reproducing the issue or more information feel free to reach out to me, I am happy to help!

@shortcuts
Copy link
Member

Hey, sorry for the issue, when adding every other existing APIs to the algoliasearch package, the search one been left out from the dependencies in the package.json. Definitely not intentional, an I'm not even sure why it hasn't been picked up by our tooling.

algolia/api-clients-automation#3988 should add the dependency back, and the SearchClient type should remain available.

I'll release 5.9.1 right away and work on a solution to better assert our algoliasearch bundle

@thegnuu
Copy link
Contributor

thegnuu commented Oct 18, 2024

@shortcuts no worries, things like this can happen. If you have a possibility to update your tooling to handle "wrong" typings it would be awesome since we had numerous small issues in the past.

Thanks a lot for the quick fix!

@shortcuts
Copy link
Member

If you have a possibility to update your tooling to handle "wrong" typings it would be awesome since we had numerous small issues in the past.

Ahaha I thought it was the case actually but seems like not really

Thanks a lot for the quick fix!

Hopefully it's good! 5.9.1 has been released

@shortcuts shortcuts self-assigned this Oct 18, 2024
@thegnuu
Copy link
Contributor

thegnuu commented Oct 20, 2024

@shortcuts well, at least we know now that it does not work ;)

Unfortunately I still have a lot of weird issues at the moment:

export 'EventType' (imported as 'EventType') was not found in '@algolia/client-personalization' (possible exports: apiClientVersion, personalizationClient)
export 'Status' (imported as 'Status') was not found in '@algolia/client-abtesting' (possible exports: abtestingClient, apiClientVersion)
export 'EventType' (imported as 'EventType') was not found in '@algolia/client-personalization' (possible exports: apiClientVersion, personalizationClient)
export 'Status' (imported as 'Status') was not found in '@algolia/client-abtesting' (possible exports: abtestingClient, apiClientVersion)
export 'EventType' (reexported as 'EventType') was not found in '@algolia/client-personalization' (possible exports: apiClientVersion, personalizationClient)
export 'Status' (reexported as 'Status') was not found in '@algolia/client-abtesting' (possible exports: abtestingClient, apiClientVersion)

I am currently not sure why this is happening, I have algoliasearch as a dependency in our SDK package, this one is buildable without any issues. As soon as I want to build it in another package which uses the SDK those errors occur. But this might as well be related to our setup, I am not sure at the moment. The weird thing is that everything works with 5.7.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants