Skip to content

Commit bc794a4

Browse files
committed
update
1 parent 0ace686 commit bc794a4

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/configuration/apiCommunicationUtils.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import { ApiCommunication, Topic } from './parsedApiConfigurationTypes';
22

3-
export function normalizeCommunication(input: Partial<ApiCommunication> & { [key: string]: any }): ApiCommunication {
3+
type RawCommunication = Partial<ApiCommunication> & {
4+
attributes?: Partial<ApiCommunication['attributes']>;
5+
topic?: Topic | Topic[] | undefined;
6+
[key: string]: unknown;
7+
};
8+
9+
export function normalizeCommunication(input: RawCommunication): ApiCommunication {
410
return {
511
attributes: {
612
componentCode: input.componentCode ?? input.attributes?.componentCode ?? '',
@@ -9,11 +15,11 @@ export function normalizeCommunication(input: Partial<ApiCommunication> & { [key
915
event: input.event ?? input.attributes?.event,
1016
eventCode: input.eventCode ?? input.attributes?.eventCode,
1117
},
12-
topic: normalizeTopic(input.topic)
18+
topic: normalizeTopic(input.topic),
1319
};
1420
}
1521

16-
function normalizeTopic(topic: Topic[] | Topic | undefined): [Topic] {
22+
function normalizeTopic(topic: Topic | Topic[] | undefined): [Topic] {
1723
if (!topic) {
1824
return [{ value: '' }];
1925
}

0 commit comments

Comments
 (0)