Skip to content

Commit 8cbc9af

Browse files
committed
add types to apply*Simplification functions
1 parent 32da669 commit 8cbc9af

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/helpers/simplify_claims.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,27 @@ export function simplifyPropertySnaks (propertySnaks: PropertySnaks, options: Si
107107
return applyArraySimplification(propertySnaks, simplifySnak, options)
108108
}
109109

110-
function applyObjectSimplification (obj, fn, options) {
110+
function applyObjectSimplification (
111+
obj: Claims | Snaks,
112+
simplifyFn: typeof simplifyPropertyClaims | typeof simplifyPropertySnaks,
113+
options: SimplifyClaimsOptions | SimplifySnaksOptions,
114+
) {
111115
const { propertyPrefix } = options
112116
const simplified = {}
113117
for (let [ propertyId, propertyArray ] of Object.entries(obj)) {
114118
if (propertyPrefix) {
115119
propertyId = propertyPrefix + ':' + propertyId
116120
}
117-
simplified[propertyId] = fn(propertyArray, options)
121+
simplified[propertyId] = simplifyFn(propertyArray, options)
118122
}
119123
return simplified
120124
}
121125

122-
function applyArraySimplification (array, simplifyFn, options) {
126+
function applyArraySimplification (
127+
array: PropertyClaims | PropertySnaks,
128+
simplifyFn: typeof simplifyClaim | typeof simplifySnak,
129+
options: SimplifyClaimsOptions | SimplifySnaksOptions,
130+
) {
123131
const simplifiedArray = array
124132
.map(claimOrSnak => simplifyFn(claimOrSnak, options))
125133
// Filter-out novalue and somevalue claims,

0 commit comments

Comments
 (0)