Skip to content

Conversation

@Haroenv
Copy link
Contributor

@Haroenv Haroenv commented Jun 23, 2021

Fixes #1080

This change marks all @algolia/* packages as bundledPackages for algoliasearch, which means that they are treated as part of this package and not external dependencies.

As a result API Extractor will throw an error if all types from @algolia/* packages that are accessible publicly through algoliasearch are not properly re-exported.

This PR is separated into 2 commits:

The 1st one updates API Extractor configuration to mark ae-forgotten-export messages as errors and updates the build script to mark all @algolia/* packages as bundledPackages (for algoliasearch only). This is done dynamically so we do not have to update the configuration if we add/remove some packages.
The 2nd one updates the actual TS files to fix the missing exports.

Copy link

@bodinsamuel bodinsamuel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it was done but I'm seeing some errors of missing export

import { Destroyable } from '@algolia/requester-common';
import { createNodeHttpRequester } from '@algolia/requester-node-http';
import { createUserAgent, RequestOptions } from '@algolia/transporter';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we just do export * from '@algolia/client-*' ?
Types listing seems unnecessary and hard to maintain + we would benefits from exporting helpers too

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(for node.ts only obviously)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like a good option, would you want to make a PR to take this over @bodinsamuel ? The only thing to be careful of with export * is that in some cases types are exported from JS files and then will have runtime errors when accessed directly from JS. I don't think that's really an issue here, but just to keep in mind

@bobylito
Copy link

bobylito commented Apr 20, 2022

Hi there, what's the status? Is there something I can help with, maybe?

I use the latest version of the client and I can't access the type for the Settings and TS is bothering me with the queryType specifically.

PS: it seems that the current workaround for this is to import from subpackages (#1080 (comment))

import { Settings } from '@algolia/client-search';

@shortcuts
Copy link
Member

closing as this is done in v5

@shortcuts shortcuts closed this Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

proposal: re-exports all types in algoliasearch

6 participants