Skip to content

Commit

Permalink
fix(headless): export missing types for ssr facet generator (#4384)
Browse files Browse the repository at this point in the history
These types can be useful for implementers.

For example, in Barca, could use them to create custom react hook
(something like `useHydratedFacet()`) and have the hook properly typed.

https://coveord.atlassian.net/browse/KIT-3461
  • Loading branch information
olamothe authored Sep 12, 2024
1 parent 7c110bc commit 687189f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ export type {

export type FacetGeneratorState = MappedFacetStates;

type MappedFacetStates = Array<MappedFacetState[FacetType]>;
export type MappedFacetStates = Array<MappedFacetState[FacetType]>;

type MappedFacetState = {
export type MappedFacetState = {
[T in FacetType]: T extends 'numericalRange'
? NumericFacetState
: T extends 'regular'
Expand Down
2 changes: 2 additions & 0 deletions packages/headless/src/ssr-commerce.index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ export type {
RegularFacet,
RegularFacetState,
RegularFacetValue,
MappedFacetStates,
MappedFacetState,
} from './controllers/commerce/core/facets/generator/headless-commerce-facet-generator.ssr';
export {defineFacetGenerator} from './controllers/commerce/core/facets/generator/headless-commerce-facet-generator.ssr';

Expand Down

0 comments on commit 687189f

Please sign in to comment.