Skip to content

Commit

Permalink
fix(signals): fix withEntitiesSingleSelection deselect methods type
Browse files Browse the repository at this point in the history
fix for withEntitiesSingleSelection to remove params of deselectEntity and
deselect[Collection]Entity

fix #112
  • Loading branch information
Gabriel Guerrero authored and gabrielguerrero committed Jul 9, 2024
1 parent 1791286 commit 3641a04
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,15 @@ export type NamedEntitiesSingleSelectionComputed<
};
export type EntitiesSingleSelectionMethods = {
selectEntity: (options: { id: string | number }) => void;
deselectEntity: (options: { id: string | number }) => void;
deselectEntity: () => void;
toggleEntity: (options: { id: string | number }) => void;
};
export type NamedEntitiesSingleSelectionMethods<Collection extends string> = {
[K in Collection as `select${Capitalize<string & K>}Entity`]: (options: {
id: string | number;
}) => void;
} & {
[K in Collection as `deselect${Capitalize<string & K>}Entity`]: (options: {
id: string | number;
}) => void;
[K in Collection as `deselect${Capitalize<string & K>}Entity`]: () => void;
} & {
[K in Collection as `toggle${Capitalize<string & K>}Entity`]: (options: {
id: string | number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('withEntitiesSingleSelection', () => {
const store = new Store();
patchState(store, setAllEntities(mockProducts));
store.selectEntity({ id: mockProducts[4].id });
store.deselectEntity({ id: mockProducts[4].id });
store.deselectEntity();
expect(store.entitySelected()).toEqual(undefined);
});

Expand Down Expand Up @@ -55,7 +55,7 @@ describe('withEntitiesSingleSelection', () => {
const store = new Store();
patchState(store, setAllEntities(mockProducts, { collection }));
store.selectProductsEntity({ id: mockProducts[4].id });
store.deselectProductsEntity({ id: mockProducts[4].id });
store.deselectProductsEntity();
expect(store.productsEntitySelected()).toEqual(undefined);
});

Expand Down

0 comments on commit 3641a04

Please sign in to comment.