fix: new ts version build error

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2021-03-27 11:35:54 +08:00
parent 4f41357953
commit bf34552321
8 changed files with 13 additions and 148 deletions

View File

@ -23,7 +23,7 @@ interface RequestConfig {
}
function request(config: RequestConfig) {
// @ts-ignore
// @ts-ignore XMLHttpRequest class only exist nashorn polyfill
let xhr = new XMLHttpRequest()
xhr.open(config.method, config.url, false)
for (const header in config.headers) {
@ -44,6 +44,7 @@ function request(config: RequestConfig) {
if (xhr.getResponseHeader("Content-Type").indexOf('application/json') != -1) {
xhr.responseType = "json"
}
// @ts-ignore get only exist nashorn polyfill
return xhr.get()
}