From e23ddb23f11e846ee24e1849dffed963e596bc5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leslie=20Leigh=20=28=E6=9D=8E=E7=9A=84=E5=BA=8F=29?= Date: Tue, 17 Mar 2020 16:20:42 +0800 Subject: [PATCH] Provide .d.ts file for illustration of DebugInfos.json (#6340) --- DebugInfos.d.ts | 15 +++++++++++++++ cocos/core/platform/debug.ts | 6 +++--- 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 DebugInfos.d.ts diff --git a/DebugInfos.d.ts b/DebugInfos.d.ts new file mode 100644 index 0000000000..abd3cfcb18 --- /dev/null +++ b/DebugInfos.d.ts @@ -0,0 +1,15 @@ + +/** + * This is a declaration file for 'DebugInfos.json' + * which is generated from 'EngineErrorMap.md'. + * You may run cli command + * `gulp build-debug-infos` or `npx gulp build-debug-infos` to generate the json file. + */ + +/** + * Engine error maps. + * The keys are error codes and their values are format strings. + */ +declare const $: Record; + +export default $; \ No newline at end of file diff --git a/cocos/core/platform/debug.ts b/cocos/core/platform/debug.ts index 4ab38bbfe8..cb3dbaf0ef 100644 --- a/cocos/core/platform/debug.ts +++ b/cocos/core/platform/debug.ts @@ -26,7 +26,8 @@ * @category core */ - // @ts-ignore +/* eslint-disable no-console */ + import debugInfos from '../../../DebugInfos'; import { EDITOR, JSB, DEV, DEBUG } from 'internal:constants'; const ERROR_MAP_URL = 'https://github.com/cocos-creator/engine/blob/3d/EngineErrorMap.md'; @@ -242,7 +243,6 @@ export function _resetDebugSetting (mode: DebugMode) { export function _throw (error_: any) { if (EDITOR) { - // @ts-ignore return error(error_); } else { const stack = error_.stack; @@ -345,7 +345,7 @@ export function getError (errorId: any, ...param: any[]): string { } /** - * @en Returns whether or not to display the FPS informations. + * @en Returns whether or not to display the FPS information. * @zh 是否显示 FPS 信息。 */ export function isDisplayStats (): boolean {