mirror of
				https://github.com/unanmed/HumanBreak.git
				synced 2025-11-04 07:02:58 +08:00 
			
		
		
		
	fix: 类型
This commit is contained in:
		
							parent
							
								
									5bf261b4a5
								
							
						
					
					
						commit
						cb4b24106d
					
				@ -578,6 +578,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
 | 
			
		||||
    battle: function () {
 | 
			
		||||
        // 这个插件负责战斗相关内容
 | 
			
		||||
 | 
			
		||||
        // 注意,对于电脑作者,极度推荐使用 vscode 进行代码编写,可以享受到新版的类型标注
 | 
			
		||||
        // 同时由于类型标注过于复杂,样板编辑器无法部署,因此样板编辑器也无法享受到新API的代码补全等
 | 
			
		||||
        // 因此极度推荐使用 vscode 进行编写
 | 
			
		||||
 | 
			
		||||
        // --------------- 战后脚本
 | 
			
		||||
        // enemy: DamageEnemy实例,也就是怪物本身
 | 
			
		||||
        // x, y: 怪物坐标
 | 
			
		||||
 | 
			
		||||
@ -644,8 +644,8 @@ export namespace Damage {
 | 
			
		||||
     * @param hero 勇士信息
 | 
			
		||||
     */
 | 
			
		||||
    export function calDamageWith(
 | 
			
		||||
        info: EnemyInfo,
 | 
			
		||||
        hero: Partial<HeroStatus>
 | 
			
		||||
        info: DeepReadonly<EnemyInfo>,
 | 
			
		||||
        hero: DeepReadonly<Partial<HeroStatus>>
 | 
			
		||||
    ): number | null {
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										16
									
								
								src/types/util.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								src/types/util.d.ts
									
									
									
									
										vendored
									
									
								
							@ -820,31 +820,27 @@ type Save = DeepReadonly<{
 | 
			
		||||
    time: number;
 | 
			
		||||
}>;
 | 
			
		||||
 | 
			
		||||
type ValueType = number | string | boolean | undefined | null | bigint | symbol;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 深度只读一个对象,使其所有属性都只读
 | 
			
		||||
 */
 | 
			
		||||
type DeepReadonly<T> = {
 | 
			
		||||
    readonly [P in keyof T]: T[P] extends number | string | boolean
 | 
			
		||||
        ? T[P]
 | 
			
		||||
        : DeepReadonly<T[P]>;
 | 
			
		||||
    readonly [P in keyof T]: T[P] extends ValueType ? T[P] : DeepReadonly<T[P]>;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 深度可选一个对象,使其所有属性都可选
 | 
			
		||||
 */
 | 
			
		||||
type DeepPartial<T> = {
 | 
			
		||||
    [P in keyof T]?: T[P] extends number | string | boolean
 | 
			
		||||
        ? T[P]
 | 
			
		||||
        : DeepPartial<T[P]>;
 | 
			
		||||
    [P in keyof T]?: T[P] extends ValueType ? T[P] : DeepPartial<T[P]>;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 深度必选一个对象,使其所有属性都必选
 | 
			
		||||
 */
 | 
			
		||||
type DeepRequired<T> = {
 | 
			
		||||
    [P in keyof T]-?: T[P] extends number | string | boolean
 | 
			
		||||
        ? T[P]
 | 
			
		||||
        : DeepRequired<T[P]>;
 | 
			
		||||
    [P in keyof T]-?: T[P] extends ValueType ? T[P] : DeepRequired<T[P]>;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@ -858,7 +854,7 @@ type Writable<T> = {
 | 
			
		||||
 * 深度可写一个对象,使其所有属性都可写
 | 
			
		||||
 */
 | 
			
		||||
type DeepWritable<T> = {
 | 
			
		||||
    -readonly [P in keyof T]: T[P] extends number | string | boolean
 | 
			
		||||
    -readonly [P in keyof T]: T[P] extends ValueType
 | 
			
		||||
        ? T[P]
 | 
			
		||||
        : DeepWritable<T[P]>;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user