diff --git a/cocos/2d/assembler/label/font-utils.ts b/cocos/2d/assembler/label/font-utils.ts index 464bcb66ea2..229a8aef819 100644 --- a/cocos/2d/assembler/label/font-utils.ts +++ b/cocos/2d/assembler/label/font-utils.ts @@ -400,7 +400,7 @@ export class LetterAtlas { } public getLetterDefinitionForChar (char: string, labelInfo: ILabelInfo): any { - const hash = char.charCodeAt(0) + labelInfo.hash; + const hash = char.charCodeAt(0).toString() + labelInfo.hash; let letter = this.fontDefDictionary.letterDefinitions[hash]; if (!letter) { const temp = new LetterTexture(char, labelInfo); @@ -445,13 +445,13 @@ export const shareLabelInfo: IShareLabelInfo = { fontScale: 1, }; -export function computeHash (labelInfo): string { +export function computeHash (labelInfo: IShareLabelInfo): string { const hashData = ''; const color = labelInfo.color.toHEX(); let out = ''; if (labelInfo.isOutlined && labelInfo.margin > 0) { - out = out + labelInfo.margin + labelInfo.out.toHEX(); + out = out + labelInfo.margin.toString() + labelInfo.out.toHEX(); } - return hashData + labelInfo.fontSize + labelInfo.fontFamily + color + out; + return hashData + labelInfo.fontSize.toString() + labelInfo.fontFamily + color + out; } diff --git a/cocos/2d/assets/sprite-atlas.ts b/cocos/2d/assets/sprite-atlas.ts index 75af3306541..1e3b05d87fe 100644 --- a/cocos/2d/assets/sprite-atlas.ts +++ b/cocos/2d/assets/sprite-atlas.ts @@ -125,6 +125,7 @@ export class SpriteAtlas extends Asset { spriteFrames: frames, }; } + return null; } /** diff --git a/cocos/3d/framework/mesh-renderer.ts b/cocos/3d/framework/mesh-renderer.ts index 0a2dff24b80..c679ef5ca7a 100644 --- a/cocos/3d/framework/mesh-renderer.ts +++ b/cocos/3d/framework/mesh-renderer.ts @@ -990,7 +990,7 @@ export class MeshRenderer extends ModelRenderer { /** * @engineInternal */ - public isUseGPUScene () { + public isUseGPUScene (): boolean { const sceneData = cclegacy.director.root.pipeline.pipelineSceneData; if (!sceneData || !sceneData.isGPUDrivenEnabled()) { return false; diff --git a/cocos/animation/animation-clip.ts b/cocos/animation/animation-clip.ts index 7285e2a1fd9..66fe4afc13c 100644 --- a/cocos/animation/animation-clip.ts +++ b/cocos/animation/animation-clip.ts @@ -1450,7 +1450,7 @@ class RootMotionEvaluation { } function relativeTransform (out: Mat4, from: Mat4, to: Mat4): void { -Mat4.invert(out, from); + Mat4.invert(out, from); Mat4.multiply(out, to, out); } @@ -1533,7 +1533,7 @@ class EventEvaluator { } } - public reset () { + public reset (): void { this._lastFrameIndex = -1; this._lastIterations = 0.0; this._lastDirection = 0; diff --git a/cocos/animation/marionette/motion/animation-blend.ts b/cocos/animation/marionette/motion/animation-blend.ts index 9162838c109..ba1f9ac8a94 100644 --- a/cocos/animation/marionette/motion/animation-blend.ts +++ b/cocos/animation/marionette/motion/animation-blend.ts @@ -212,7 +212,7 @@ class AnimationBlendPort implements MotionPort { return this._host.__evaluatePort(this, progress, context); } - public reenter () { + public reenter (): void { const { childPorts } = this; const nChildPorts = childPorts.length; for (let iChild = 0; iChild < nChildPorts; ++iChild) { diff --git a/cocos/animation/marionette/motion/clip-motion.ts b/cocos/animation/marionette/motion/clip-motion.ts index def4d6ca5af..12fd4172b28 100644 --- a/cocos/animation/marionette/motion/clip-motion.ts +++ b/cocos/animation/marionette/motion/clip-motion.ts @@ -168,7 +168,7 @@ class ClipMotionEval implements MotionEval { } } - public reenter () { + public reenter (): void { this._frameEventEval?.reset(); } @@ -216,7 +216,7 @@ class ClipMotionPort implements MotionPort { return this._eval[evaluatePortTag](progress, context); } - public reenter () { + public reenter (): void { this._eval.reenter(); } diff --git a/cocos/audio/audio-manager.ts b/cocos/audio/audio-manager.ts index 1db9a09b026..a7041c5dd52 100644 --- a/cocos/audio/audio-manager.ts +++ b/cocos/audio/audio-manager.ts @@ -23,7 +23,7 @@ */ import { AudioPlayer, OneShotAudio } from 'pal/audio'; -import { js } from '../core'; +import { error, js } from '../core'; type ManagedAudio = AudioPlayer | OneShotAudio; interface AudioInfo { @@ -97,7 +97,7 @@ export class AudioManager { }); } if (audioInfoToDiscard) { - audioInfoToDiscard.audio.stop(); + audioInfoToDiscard.audio.stop()?.catch((err) => { error(err); }); this.removePlaying(audioInfoToDiscard.audio); } } diff --git a/cocos/core/data/utils/compact-value-type-array.ts b/cocos/core/data/utils/compact-value-type-array.ts index 7ef55c50be1..338ac3450df 100644 --- a/cocos/core/data/utils/compact-value-type-array.ts +++ b/cocos/core/data/utils/compact-value-type-array.ts @@ -24,6 +24,7 @@ import { ccclass, serializable } from 'cc.decorator'; import { Vec3, Quat, Vec4, Vec2, Mat4 } from '../../math'; +import { error } from '../../platform'; export enum StorageUnit { Uint8, Uint16, Uint32, @@ -110,9 +111,9 @@ export class CompactValueTypeArray { */ public static compress (values: any[], elementType: ElementType, unit: StorageUnit, arrayBuffer: ArrayBuffer, byteOffset: number, presumedByteOffset: number): CompactValueTypeArray { const elementTraits = getElementTraits(elementType); - const storageConstructor = getStorageConstructor(unit); + const StorageConstructor = getStorageConstructor(unit); const unitCount = elementTraits.requiredUnits * values.length; - const storage = new storageConstructor(arrayBuffer, byteOffset, unitCount); + const storage = new StorageConstructor(arrayBuffer, byteOffset, unitCount); for (let i = 0; i < values.length; ++i) { elementTraits.compress(storage, i, values[i]); } @@ -132,8 +133,8 @@ export class CompactValueTypeArray { public decompress (arrayBuffer: ArrayBuffer): T[] { const { storageUnit, elementType } = extractStorageUnitElementType(this._unitElement); const elementTraits = getElementTraits(elementType); - const storageConstructor = getStorageConstructor(storageUnit); - const storage = new storageConstructor(arrayBuffer, this._byteOffset, this._unitCount); + const StorageConstructor = getStorageConstructor(storageUnit); + const storage = new StorageConstructor(arrayBuffer, this._byteOffset, this._unitCount); const result = new Array(this._length); for (let i = 0; i < this._length; ++i) { result[i] = elementTraits.decompress(storage, i); @@ -164,6 +165,9 @@ function getStorageConstructor (unit: StorageUnit): TypedArrayConstructor { return Float32Array; case StorageUnit.Float64: return Float64Array; + default: + error('Unknown uint type. Return Uint8Array.'); + return Uint8Array; } } diff --git a/cocos/core/data/utils/extends-enum.ts b/cocos/core/data/utils/extends-enum.ts index 546ed14c86e..09a4abe70f1 100644 --- a/cocos/core/data/utils/extends-enum.ts +++ b/cocos/core/data/utils/extends-enum.ts @@ -44,7 +44,7 @@ import { errorID } from '../../platform/debug'; * const ApplePen = extendsEnum(Apple, Pen); * ``` */ -export function extendsEnum (): {}; +export function extendsEnum (): {} export function extendsEnum (e0: E0): E0; diff --git a/cocos/core/data/utils/preprocess-class.ts b/cocos/core/data/utils/preprocess-class.ts index b326e484a52..2ad836fab45 100644 --- a/cocos/core/data/utils/preprocess-class.ts +++ b/cocos/core/data/utils/preprocess-class.ts @@ -92,7 +92,8 @@ function parseType (val, type, className, propName): void { if (type.length > 0) { val.type = type = type[0]; } else { - return errorID(5508, className, propName); + errorID(5508, className, propName); + return; } } if (typeof type === 'function') { @@ -132,6 +133,8 @@ function parseType (val, type, className, propName): void { case null: warnID(5511, className, propName); break; + default: + break; } } @@ -153,6 +156,7 @@ function getBaseClassWherePropertyDefined_DEV (propName, cls): any { } return res; } + return null; } function _wrapOptions (isGetset: boolean, _default, type?: Function | Function[] | PrimitiveType): {