修改扩展导入失败提示,修改扩展模板为esm,添加cost和getIndex的类型注释,跟进并修复其他类型注释

This commit is contained in:
nonameShijian 2024-04-14 01:11:00 +08:00
parent dcb703b240
commit 6bb7e44704
5 changed files with 151 additions and 40 deletions

View File

@ -517,72 +517,86 @@ export class Game {
* @overload
* @param { 'character' } type
* @param {(
* lib: Library,
* game: typeof Game,
* ui: UI,
* get: Get,
* ai: AI,
* _status: Status
* lib: InstanceType<typeof import('../library/index.js').Library>,
* game: InstanceType<typeof Game>,
* ui: InstanceType<typeof import('../ui/index.js').UI>,
* get: InstanceType<typeof import('../get/index.js').Get>,
* ai: InstanceType<typeof import('../ai/index.js').AI>,
* _status: InstanceType<typeof import('../status/index.js').status>
* ) => importCharacterConfig } content
* @param {*} [url]
*/
import(type: 'character', content: (lib: any, game: typeof Game, ui: any, get: any, ai: any, _status: any) => importCharacterConfig, url?: any): any;
import(type: 'character', content: (lib: InstanceType<typeof import('../library/index.js').Library>, game: InstanceType<typeof Game>, ui: InstanceType<typeof import('../ui/index.js').UI>, get: InstanceType<typeof import('../get/index.js').Get>, ai: InstanceType<typeof import('../ai/index.js').AI>, _status: InstanceType<typeof import('../status/index.js').status>) => importCharacterConfig, url?: any): any;
/**
* @overload
* @param { 'card' } type
* @param {(
* lib: Library,
* game: typeof Game,
* ui: UI,
* get: Get,
* ai: AI,
* _status: Status
* lib: InstanceType<typeof import('../library/index.js').Library>,
* game: InstanceType<typeof Game>,
* ui: InstanceType<typeof import('../ui/index.js').UI>,
* get: InstanceType<typeof import('../get/index.js').Get>,
* ai: InstanceType<typeof import('../ai/index.js').AI>,
* _status: InstanceType<typeof import('../status/index.js').status>
* ) => importCardConfig } content
* @param {*} [url]
*/
import(type: 'card', content: (lib: any, game: typeof Game, ui: any, get: any, ai: any, _status: any) => importCardConfig, url?: any): any;
import(type: 'card', content: (lib: InstanceType<typeof import('../library/index.js').Library>, game: InstanceType<typeof Game>, ui: InstanceType<typeof import('../ui/index.js').UI>, get: InstanceType<typeof import('../get/index.js').Get>, ai: InstanceType<typeof import('../ai/index.js').AI>, _status: InstanceType<typeof import('../status/index.js').status>) => importCardConfig, url?: any): any;
/**
* @overload
* @param { 'mode' } type
* @param {(
* lib: Library,
* game: typeof Game,
* ui: UI,
* get: Get,
* ai: AI,
* _status: Status
* lib: InstanceType<typeof import('../library/index.js').Library>,
* game: InstanceType<typeof Game>,
* ui: InstanceType<typeof import('../ui/index.js').UI>,
* get: InstanceType<typeof import('../get/index.js').Get>,
* ai: InstanceType<typeof import('../ai/index.js').AI>,
* _status: InstanceType<typeof import('../status/index.js').status>
* ) => importModeConfig } content
* @param {*} [url]
*/
import(type: 'mode', content: (lib: any, game: typeof Game, ui: any, get: any, ai: any, _status: any) => importModeConfig, url?: any): any;
import(type: 'mode', content: (lib: InstanceType<typeof import('../library/index.js').Library>, game: InstanceType<typeof Game>, ui: InstanceType<typeof import('../ui/index.js').UI>, get: InstanceType<typeof import('../get/index.js').Get>, ai: InstanceType<typeof import('../ai/index.js').AI>, _status: InstanceType<typeof import('../status/index.js').status>) => importModeConfig, url?: any): any;
/**
* @overload
* @param { 'player' } type
* @param {(
* lib: Library,
* game: typeof Game,
* ui: UI,
* get: Get,
* ai: AI,
* _status: Status
* lib: InstanceType<typeof import('../library/index.js').Library>,
* game: InstanceType<typeof Game>,
* ui: InstanceType<typeof import('../ui/index.js').UI>,
* get: InstanceType<typeof import('../get/index.js').Get>,
* ai: InstanceType<typeof import('../ai/index.js').AI>,
* _status: InstanceType<typeof import('../status/index.js').status>
* ) => importPlayerConfig } content
* @param {*} [url]
*/
import(type: 'player', content: (lib: any, game: typeof Game, ui: any, get: any, ai: any, _status: any) => importPlayerConfig, url?: any): any;
import(type: 'player', content: (lib: InstanceType<typeof import('../library/index.js').Library>, game: InstanceType<typeof Game>, ui: InstanceType<typeof import('../ui/index.js').UI>, get: InstanceType<typeof import('../get/index.js').Get>, ai: InstanceType<typeof import('../ai/index.js').AI>, _status: InstanceType<typeof import('../status/index.js').status>) => importPlayerConfig, url?: any): any;
/**
* @overload
* @param { 'extension' } type
* @param {(
* lib: Library,
* game: typeof Game,
* ui: UI,
* get: Get,
* ai: AI,
* _status: Status
* lib: InstanceType<typeof import('../library/index.js').Library>,
* game: InstanceType<typeof Game>,
* ui: InstanceType<typeof import('../ui/index.js').UI>,
* get: InstanceType<typeof import('../get/index.js').Get>,
* ai: InstanceType<typeof import('../ai/index.js').AI>,
* _status: InstanceType<typeof import('../status/index.js').status>
* ) => importExtensionConfig } content
* @param {*} [url]
*/
import(type: 'extension', content: (lib: any, game: typeof Game, ui: any, get: any, ai: any, _status: any) => importExtensionConfig, url?: any): any;
import(type: 'extension', content: (lib: InstanceType<typeof import('../library/index.js').Library>, game: InstanceType<typeof Game>, ui: InstanceType<typeof import('../ui/index.js').UI>, get: InstanceType<typeof import('../get/index.js').Get>, ai: InstanceType<typeof import('../ai/index.js').AI>, _status: InstanceType<typeof import('../status/index.js').status>) => importExtensionConfig, url?: any): any;
/**
* @overload
* @param { 'play' } type
* @param {(
* lib: InstanceType<typeof import('../library/index.js').Library>,
* game: InstanceType<typeof Game>,
* ui: InstanceType<typeof import('../ui/index.js').UI>,
* get: InstanceType<typeof import('../get/index.js').Get>,
* ai: InstanceType<typeof import('../ai/index.js').AI>,
* _status: InstanceType<typeof import('../status/index.js').status>
* ) => importPlayConfig } content
* @param {*} [url]
*/
import(type: 'play', content: (lib: InstanceType<typeof import('../library/index.js').Library>, game: InstanceType<typeof Game>, ui: InstanceType<typeof import('../ui/index.js').UI>, get: InstanceType<typeof import('../get/index.js').Get>, ai: InstanceType<typeof import('../ai/index.js').AI>, _status: InstanceType<typeof import('../status/index.js').status>) => importPlayConfig, url?: any): any;
loadExtension(object: any): Promise<any>;
/**
*
@ -611,9 +625,9 @@ export class Game {
removeFile: ((filename: string, callback?: ((e: Error) => void) | undefined) => void) | undefined;
/**
*
* @type { undefined | ((dir: string, success: (folders: string[], files: string[]) => any, failure: (e: Error) => void) => void) }
* @type { undefined | ((dir: string, success: (folders: string[], files: string[]) => any, failure?: (e: Error) => void) => void) }
*/
getFileList: ((dir: string, success: (folders: string[], files: string[]) => any, failure: (e: Error) => void) => void) | undefined;
getFileList: ((dir: string, success: (folders: string[], files: string[]) => any, failure?: ((e: Error) => void) | undefined) => void) | undefined;
/**
*
* @type { undefined | ((list: string | string[], callback: Function, file?: boolean) => void) }
@ -959,8 +973,9 @@ export class Game {
addGlobalSkill(skill: string, player?: any): boolean;
/**
* @param { string } skill
* @param { lib.element.Player } player
*/
removeGlobalSkill(skill: string): void;
removeGlobalSkill(skill: string, player: lib.element.Player): void;
resetSkills(): void;
/**
* @param { string } extensionName
@ -1371,6 +1386,7 @@ export type GameHistory = {
everything: GameEventPromise[];
};
export type Video = {
name?: string;
type: string;
player?: string;
content?: string | any[];

View File

@ -896,6 +896,7 @@ export class Player extends HTMLDivElement {
lose(...args: any[]): any;
damage(...args: any[]): any;
recover(...args: any[]): any;
recoverTo(...args: any[]): any;
doubleDraw(): any;
loseHp(num: any): any;
loseMaxHp(...args: any[]): any;

View File

@ -4043,7 +4043,10 @@ export class Library {
readonly nodews: Element.NodeWS;
};
card: {
list: never[];
/**
* @type { [CardBaseUIData['suit'], CardBaseUIData['number'], string][] }
*/
list: [CardBaseUIData['suit'], CardBaseUIData['number'], string][];
cooperation_damage: {
fullskin: boolean;
};

View File

@ -45,6 +45,24 @@ export class status {
* @type { boolean | void }
*/
connectMode: boolean | void;
/**
* @type { boolean | void }
*/
importingExtension: boolean | void;
/**
* @type { Promise<any>[] | void }
*/
extensionLoaded: Promise<any>[] | void;
/**
* @type { Promise<any>[] | void }
*/
extensionLoading: Promise<any>[] | void;
/**
* @type { { [key: string]: Promise<any>[] } | void }
*/
importing: void | {
[key: string]: Promise<any>[];
};
}
export let _status: status;
export function setStatus(instance?: status | undefined): void;

View File

@ -195,7 +195,6 @@ declare interface importCharacterConfig {
*
*/
game?: SMap<any>;
/**
*
*
@ -538,6 +537,80 @@ declare interface importExtensionConfig {
[key: string]: any;
}
/**
*
*/
declare interface importPlayConfig {
/** 扩展名 */
name: string;
arenaReady?: Function;
/**
*
*/
video?: Function;
/**
*
* */
skill?: SMap<Skill>;
/**
*
*
* */
card?: SMap<any>;
translate?: SMap<string>;
/**
* lib.element
*
*
*/
element?: SMap<any>;
/**
* ai
*
*
*/
ai?: SMap<any>;
/**
* ui
*
*
*/
ui?: SMap<any>;
/**
* game
*
*
*/
game?: SMap<any>;
/**
*
*
* get
*
*/
get?: SMap<any>;
/**
*
*
*
*
* "帮助条目":
* ```jsx
* <ul>
* <li>1-1
* <li>1-2
* </ul>
* <ol>
* <li>2-1
* <li>2-2
* </ul>
* ```
* (modeextensioncard卡包character武将包)
*/
help?: SMap<string>;
[key: string]: any;
}
/**
*
*