Skip to content

Commit 0805fee

Browse files
committed
add types to parseSnak function
1 parent 8cbc9af commit 0805fee

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/helpers/parse_snak.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { wikibaseTimeToEpochTime, wikibaseTimeToISOString, wikibaseTimeToSimpleDay } from './time.js'
22
import type { TimeInputValue } from './time.js'
3+
import type { DataType } from '../types/claim.js'
4+
import type { SimplifySnakOptions } from '../types/simplify_claims.js'
5+
import type { SnakValue } from '../types/snakvalue.js'
36

47
const simple = datavalue => datavalue.value
58

@@ -105,9 +108,9 @@ for (const [ datatype, parser ] of Object.entries(parsers)) {
105108
normalizedParsers[normalizeDatatype(datatype)] = parser
106109
}
107110

108-
export function parseSnak (datatype, datavalue, options) {
111+
export function parseSnak (datatype: DataType | void, datavalue: SnakValue, options: SimplifySnakOptions) {
109112
// Known case of missing datatype: form.claims, sense.claims, mediainfo.statements
110-
datatype = datatype || datavalue.type
113+
datatype = (datatype || datavalue.type) as DataType
111114

112115
try {
113116
// Known case requiring normalization

0 commit comments

Comments
 (0)