修改history的类型名称,添加其他类型

This commit is contained in:
shijian 2023-12-31 23:39:45 +08:00
parent 9fdf573bc7
commit 28c7dba845
4 changed files with 16 additions and 16 deletions

View File

@ -34,6 +34,8 @@ declare type VCard = import('../../noname/library/index.js').VCard;
declare type Video = import('../../noname/game/index.js').Video; declare type Video = import('../../noname/game/index.js').Video;
declare type Videos = import('../../noname/game/index.js').Videos; declare type Videos = import('../../noname/game/index.js').Videos;
declare type History = import('../../noname/game/index.js').History; declare type GameHistory = import('../../noname/game/index.js').GameHistory;
declare type CodeMirror = typeof import('../../game/codemirror.js').default; declare type CodeMirror = typeof import('../../game/codemirror.js').default;
declare type Sex = 'male' | 'female' | 'dobule' | 'none';
declare type Character = [Sex, string, number | string, string[], ...any[]];

View File

@ -5,7 +5,7 @@
* useCard: GameEventPromise[], * useCard: GameEventPromise[],
* changeHp: GameEventPromise[], * changeHp: GameEventPromise[],
* everything: GameEventPromise[] * everything: GameEventPromise[]
* }} History * }} GameHistory
* @typedef { { type: string, player?: string, content?: string | any[], delay: number } } Video * @typedef { { type: string, player?: string, content?: string | any[], delay: number } } Video
* @typedef { { mode: string, name: string[], name1: string, name2?: string, time: number, video: Video, win: boolean } } Videos * @typedef { { mode: string, name: string[], name1: string, name2?: string, time: number, video: Video, win: boolean } } Videos
*/ */
@ -773,7 +773,7 @@ export class Game extends Uninstantable {
return 'common'; return 'common';
} }
/** /**
* @template { keyof History } T * @template { keyof GameHistory } T
* @param { T } key * @param { T } key
* @param { (event: GameEventPromise) => boolean } filter * @param { (event: GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last] * @param { GameEventPromise } [last]
@ -797,7 +797,7 @@ export class Game extends Uninstantable {
} }
} }
/** /**
* @template { keyof History } T * @template { keyof GameHistory } T
* @param { T } key * @param { T } key
* @param { (event: GameEventPromise) => boolean } filter * @param { (event: GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last] * @param { GameEventPromise } [last]
@ -822,15 +822,15 @@ export class Game extends Uninstantable {
} }
/** /**
* @overload * @overload
* @returns { History } * @returns { GameHistory }
*/ */
/** /**
* @template { keyof History } T * @template { keyof GameHistory } T
* @overload * @overload
* @param { T } key * @param { T } key
* @param { (event: GameEventPromise) => boolean } [filter] * @param { (event: GameEventPromise) => boolean } [filter]
* @param { GameEventPromise } [last] * @param { GameEventPromise } [last]
* @returns { History[T] } * @returns { GameHistory[T] }
*/ */
static getGlobalHistory(key, filter, last) { static getGlobalHistory(key, filter, last) {
if (!key) return _status.globalHistory[_status.globalHistory.length - 1]; if (!key) return _status.globalHistory[_status.globalHistory.length - 1];
@ -848,7 +848,7 @@ export class Game extends Uninstantable {
} }
} }
/** /**
* @template { keyof History } T * @template { keyof GameHistory } T
* @param { T } key * @param { T } key
* @param { (event: GameEventPromise) => boolean } filter * @param { (event: GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last] * @param { GameEventPromise } [last]
@ -872,7 +872,7 @@ export class Game extends Uninstantable {
}) })
} }
/** /**
* @template { keyof History } T * @template { keyof GameHistory } T
* @param { T } key * @param { T } key
* @param { (event: GameEventPromise) => boolean } filter * @param { (event: GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last] * @param { GameEventPromise } [last]
@ -899,15 +899,15 @@ export class Game extends Uninstantable {
} }
/** /**
* @overload * @overload
* @returns { History[] } * @returns { GameHistory[] }
*/ */
/** /**
* @template { keyof History } T * @template { keyof GameHistory } T
* @overload * @overload
* @param { T } key * @param { T } key
* @param { (event: GameEventPromise) => boolean } [filter] * @param { (event: GameEventPromise) => boolean } [filter]
* @param { GameEventPromise } [last] * @param { GameEventPromise } [last]
* @returns { History[T] } * @returns { GameHistory[T] }
*/ */
static getAllGlobalHistory(key, filter, last) { static getAllGlobalHistory(key, filter, last) {
const history = []; const history = [];

View File

@ -7,8 +7,6 @@
* @typedef { InstanceType<typeof lib.element.GameEvent> } GameEvent * @typedef { InstanceType<typeof lib.element.GameEvent> } GameEvent
* @typedef { InstanceType<typeof lib.element.GameEvent> & InstanceType<typeof lib.element.GameEventPromise> & typeof Promise<typeof lib.element.GameEvent> } GameEventPromise * @typedef { InstanceType<typeof lib.element.GameEvent> & InstanceType<typeof lib.element.GameEventPromise> & typeof Promise<typeof lib.element.GameEvent> } GameEventPromise
* @typedef { InstanceType<typeof lib.element.NodeWS> } NodeWS * @typedef { InstanceType<typeof lib.element.NodeWS> } NodeWS
* @typedef { 'male' | 'female' | 'dobule' | 'none' } Sex
* @typedef { [Sex, string, number | string, string[], any[]] } Character
*/ */
import { nonameInitialized, assetURL, userAgent, Uninstantable, GeneratorFunction, AsyncFunction } from "../util/index.js"; import { nonameInitialized, assetURL, userAgent, Uninstantable, GeneratorFunction, AsyncFunction } from "../util/index.js";
import { AI as ai } from '../ai/index.js'; import { AI as ai } from '../ai/index.js';

View File

@ -17,7 +17,7 @@ export const status = {
dragline: [], dragline: [],
dying: [], dying: [],
/** /**
* @type { History[] } * @type { GameHistory[] }
*/ */
globalHistory: [{ globalHistory: [{
// @ts-ignore // @ts-ignore