Merge pull request #1207 from kuangshen04/test-Branch

更新并优化Array的类型提示
This commit is contained in:
Spmario233 2024-04-15 10:53:10 +08:00 committed by GitHub
commit 16555acdd8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 40 additions and 42 deletions

View File

@ -4,72 +4,64 @@ declare interface Array<T> {
* @deprecated 使includes
*/
contains(item: T): boolean;
containsSome(...item: T): boolean;
containsAll(...item: T): boolean;
containsSome(...item: T[]): boolean;
containsAll(...item: T[]): boolean;
/**
*
*
* @param args
* @returns
* 1.
* 2. ()false
*/
add(...args: T[]): this | false;
add(...item: T[]): this;
/**
* (this.add)arr中若有一个数组元素可能会出现bug
* (this.add)arr中若有一个数组元素可能会出现bug
* @param arr
*/
addArray(arr: T[]): this;
addArray(...arr: T[][]): this;
/**
* ()
* ()
* @param item
* @returns
* 1.
* 2. ()false
* 3. undefined
*/
remove(item: T): this | false;
remove(item: T[]): void;
remove(...item: T[]): this;
/**
* (this.remove)arr中若有一个数组元素可能会出现bug
* (this.remove)arr中若有一个数组元素可能会出现bug
* @param arr
*/
removeArray(...arr: T[]): this;
removeArray(...arr: T[][]): this;
/**
*
* @param args
* @param excludes
*/
randomGet(...args: T[]): T;
randomGet(...excludes: T[]): T;
/**
* /
* @param num num为数字的情况下num个元素
*
* @param num 0
*/
randomGets(num?: number): T[];
/**
* undefined
*/
randomRemove(): T | undefined;
/**
*
* @param num
* @returns
* 1.
* 2.
* 3. undefined
*/
randomRemove(num?: number): T | T[];
randomRemove(num?: T): T | undefined;
randomRemove(num: number): T[];
/**
*
*
*/
randomSort(): this;
/**
*
*
*
*
* @param num , 0
*/
randomGets(num?: number): this;
/**
*
* *使lib.sort.seat方法
*
* 使lib.sort.seat方法
* @param target
* @param target
*/
sortBySeat(target?: Player): Player[];
sortBySeat(target?: Player): this;
/**
* Array中所有位于处理区的卡牌过滤出来
* Array中所有位于处理区的卡牌过滤出来
*
* list为[c1,c2,c3,c4]c1和c3是位于处理区的卡牌
* list.filterInD()[c1,c3]
@ -77,11 +69,11 @@ declare interface Array<T> {
* 1.9.97.8.1:
*
* list.filterInD('h')
* @param poiston 'o'
* @param position 'o'
*/
filterInD(poiston?: "e" | "j" | "x" | "s" | "h" | "c" | "d" | "o"): Card[];
someInD(poiston?: "e" | "j" | "x" | "s" | "h" | "c" | "d" | "o"): boolean;
everyInD(poiston?: "e" | "j" | "x" | "s" | "h" | "c" | "d" | "o"): boolean;
filterInD(position?: "e" | "j" | "x" | "s" | "h" | "c" | "d" | "o"): this;
someInD(position?: "e" | "j" | "x" | "s" | "h" | "c" | "d" | "o"): boolean;
everyInD(position?: "e" | "j" | "x" | "s" | "h" | "c" | "d" | "o"): boolean;
//关于处理区:
/*
@ -105,7 +97,13 @@ declare interface Array<T> {
* item
*/
numOf(item: T): number;
/**
*
*/
unique(): this;
/**
*
*/
toUniqued(): T[];
maxBy(sortBy?: Function, filter?: typeof Array['prototype']['filter']): T;
minBy(sortBy?: Function, filter?: typeof Array['prototype']['filter']): T;