Fix TS error
This commit is contained in:
parent
10ef0fc4e4
commit
a05ee0eedc
1 changed files with 3 additions and 3 deletions
|
@ -31,9 +31,9 @@ function getLocation(id: string, solution: boolean): TaskLocation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseTask(startElementId: string, html: string, contentType: DOMParserSupportedType): string {
|
function parseTask(startElementId: string, html: string, contentType: string): string {
|
||||||
const parser = new DOMParser()
|
const parser = new DOMParser()
|
||||||
const doc = parser.parseFromString(html, contentType)
|
const doc = parser.parseFromString(html, contentType as any)
|
||||||
|
|
||||||
const titleElement = doc.getElementById(startElementId)
|
const titleElement = doc.getElementById(startElementId)
|
||||||
if (!titleElement)
|
if (!titleElement)
|
||||||
|
@ -69,7 +69,7 @@ async function loadTask({ url, startElement }: TaskLocation) {
|
||||||
throw Error("Bad request")
|
throw Error("Bad request")
|
||||||
}
|
}
|
||||||
const rText = await r.text()
|
const rText = await r.text()
|
||||||
const contentType = r.headers.get("Content-Type") as DOMParserSupportedType || "text/html"
|
const contentType = r.headers.get("Content-Type") || "text/html"
|
||||||
return parseTask(startElement, rText, contentType)
|
return parseTask(startElement, rText, contentType)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue