File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 1
1
import { ApiCommunication , Topic } from './parsedApiConfigurationTypes' ;
2
2
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 {
4
10
return {
5
11
attributes : {
6
12
componentCode : input . componentCode ?? input . attributes ?. componentCode ?? '' ,
@@ -9,11 +15,11 @@ export function normalizeCommunication(input: Partial<ApiCommunication> & { [key
9
15
event : input . event ?? input . attributes ?. event ,
10
16
eventCode : input . eventCode ?? input . attributes ?. eventCode ,
11
17
} ,
12
- topic : normalizeTopic ( input . topic )
18
+ topic : normalizeTopic ( input . topic ) ,
13
19
} ;
14
20
}
15
21
16
- function normalizeTopic ( topic : Topic [ ] | Topic | undefined ) : [ Topic ] {
22
+ function normalizeTopic ( topic : Topic | Topic [ ] | undefined ) : [ Topic ] {
17
23
if ( ! topic ) {
18
24
return [ { value : '' } ] ;
19
25
}
You can’t perform that action at this time.
0 commit comments