Provide .d.ts file for illustration of DebugInfos.json (#6340)

This commit is contained in:
Leslie Leigh (李的序)
2020-03-17 16:20:42 +08:00
committed by GitHub
parent d049b259f2
commit e23ddb23f1
2 changed files with 18 additions and 3 deletions
+15
View File
@@ -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<number, string>;
export default $;
+3 -3
View File
@@ -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 {