feat: update typescript version

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2021-12-26 01:21:06 +08:00
parent 72173b4778
commit 5ed61829e1
68 changed files with 234 additions and 161 deletions

View File

@ -29,6 +29,6 @@
"@types/base64-js": "^1.3.0",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"typescript": "^4.3.5"
"typescript": "^4.5.3"
}
}

View File

@ -45,7 +45,7 @@ export namespace command {
return (sender: any, _: any, command: string, args: string[]) => {
try {
return executor(sender, command, Java.from(args))
} catch (ex) {
} catch (ex: any) {
console.i18n("ms.api.command.execute.error", { player: sender.name, plugin: plugin.description.name, command, args: Java.from(args).join(' '), ex })
console.ex(ex)
if (sender.name != 'CONSOLE') {
@ -61,7 +61,7 @@ export namespace command {
var token = args[args.length - 1]
var complete = tabCompleter(sender, command, Java.from(args)) || []
return this.copyPartialMatches(complete, token)
} catch (ex) {
} catch (ex: any) {
console.i18n("ms.api.command.tab.completer.error", { player: sender.name, plugin: plugin.description.name, command, args: Java.from(args).join(' '), ex })
console.ex(ex)
console.sender(sender, [i18n.translate("ms.api.command.tab.completer.error", { player: sender.name, plugin: plugin.description.name, command, args: Java.from(args).join(' '), ex }), ...console.stack(ex)])

View File

@ -123,7 +123,7 @@ export class MiaoScriptConsole implements Console {
if (sourceMapping && lineNumber != sourceMapping.mapping.sourceLine) { lineNumber = sourceMapping.mapping.sourceLine }
}
}
} catch (error) {
} catch (error: any) {
console.debug('search source map', fileName, 'line', lineNumber, 'error:', error)
if (global.debug) {
console.ex(error)

View File

@ -57,7 +57,7 @@ export namespace event {
this.mapEvent[simpleName] = clazz
count++
}
} catch (ex) {
} catch (ex: any) {
//ignore already loaded class
}
}
@ -82,9 +82,9 @@ export namespace event {
let eventCls = this.mapEvent[event.toLowerCase()] || this.mapEvent[event.toLowerCase() + 'event']
if (!eventCls) {
try {
eventCls = base.getClass(eventCls)
eventCls = base.getClass(event)
this.mapEvent[event] = eventCls
} catch (ex) {
} catch (ex: any) {
console.i18n("ms.api.event.not.found", { name, event })
return
}
@ -104,7 +104,7 @@ export namespace event {
console.i18n("ms.api.event.execute.slow", { name, event: this.class2Name(eventCls), cost })
}
}
} catch (ex) {
} catch (ex: any) {
console.i18n("ms.api.event.execute.error", { name, event: this.class2Name(eventCls), ex })
console.ex(ex)
}

View File

@ -467,7 +467,7 @@ export namespace particle {
console.warn(`ParticleTask ${this.taskId} particle ${this.particle.getUUID()} cancel because entity and location both undefined!`)
this.task.cancel()
}
} catch (error) {
} catch (error: any) {
console.error(`§6插件 §a${this.owner.description.name} §c播放粒子发送异常 §4粒子播放任务已终止!`)
console.ex(error)
this.cancel()

View File

@ -134,7 +134,7 @@ export namespace server {
let consoleServer = this.getDedicatedServer()
this.reflectPipeline(consoleServer)
this.reflectRootLogger(consoleServer)
} catch (error) {
} catch (error: any) {
console.error('Error When Reflect MinecraftServer!', error)
console.ex(error)
}
@ -148,7 +148,7 @@ export namespace server {
if (connection.class.name.indexOf('ServerConnection') !== -1
|| connection.class.name.indexOf('NetworkSystem') !== -1) { break }
connection = undefined
} catch (error) {
} catch (error: any) {
if (global.debug) {
console.ex(error)
}
@ -160,7 +160,7 @@ export namespace server {
promise = reflect.on(connection).get(field).get().get(0)
if (promise.class.name.indexOf('Promise') !== -1) { break }
promise = undefined
} catch (error) {
} catch (error: any) {
if (global.debug) {
console.ex(error)
}
@ -173,13 +173,13 @@ export namespace server {
protected reflectRootLogger(consoleServer: any) {
try {
this.rootLogger = reflect.on(consoleServer).get('LOGGER').get().parent
} catch (error) {
} catch (error: any) {
if (global.debug) {
console.ex(error)
}
try {
this.rootLogger = reflect.on(consoleServer).get(0).get().parent
} catch (error) {
} catch (error: any) {
if (global.debug) {
console.ex(error)
}

View File

@ -142,7 +142,7 @@ export namespace task {
try {
this.func(...args)
!this.interval && process.emit('task.finish', this)
} catch (ex) {
} catch (ex: any) {
console.console('§4插件执行任务时发生错误', ex)
console.ex(ex)
}