Skip to content

Commit

Permalink
optional mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderkirtzel committed Jul 22, 2024
1 parent 6045277 commit 65985fd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ describe('Destination', () => {

jest.clearAllMocks();

destinationIgnore.config.mapping!.foo!.bar.ignore = true;
destinationIgnore.config.mapping!.foo!.bar!.ignore = true;
elb('foo bar');
expect(mockPushA).toHaveBeenCalledTimes(0);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/clients/walkerjs/src/lib/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export function pushToDestination(
}

// Check for an active mapping for proper event handling
let mappingEvent: WebDestination.EventConfig;
let mappingEvent: undefined | WebDestination.EventConfig;
const mapping = destination.config.mapping;
let mappingKey = '';

Expand Down
4 changes: 3 additions & 1 deletion packages/types/src/destination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export interface Config<Custom = unknown, EventCustom = unknown> {
}

export interface Mapping<EventCustom> {
[entity: string]: undefined | { [action: string]: EventConfig<EventCustom> };
[entity: string]:
| undefined
| { [action: string]: undefined | EventConfig<EventCustom> };
}

export interface Batch<EventCustom> {
Expand Down

0 comments on commit 65985fd

Please sign in to comment.