Skip to content

Commit e3089ec

Browse files
feat: add types of original array methods of PathNiceArr
1 parent 4ef6f26 commit e3089ec

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

src/core/path-nice.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2089,3 +2089,57 @@ export interface ParsedPathNice {
20892089
name(): string;
20902090
name(newName: string): this;
20912091
}
2092+
2093+
export interface PathNiceArr {
2094+
/**
2095+
* Combines two or more arrays.
2096+
* This method returns a new array without modifying any existing arrays.
2097+
* @param items Additional arrays and/or items to add to the end of the array.
2098+
*/
2099+
concat(...items: ConcatArray<PathNice>[]): PathNiceArr;
2100+
/**
2101+
* Combines two or more arrays.
2102+
* This method returns a new array without modifying any existing arrays.
2103+
* @param items Additional arrays and/or items to add to the end of the array.
2104+
*/
2105+
concat(...items: (PathNice | ConcatArray<PathNice>)[]): PathNiceArr;
2106+
/**
2107+
* Reverses the elements in an array in place.
2108+
* This method mutates the array and returns a reference to the same array.
2109+
*/
2110+
reverse(): PathNiceArr;
2111+
/**
2112+
* Returns a copy of a section of an array.
2113+
* For both start and end, a negative index can be used to indicate an offset from the end of the array.
2114+
* For example, -2 refers to the second to last element of the array.
2115+
* @param start The beginning index of the specified portion of the array.
2116+
* If start is undefined, then the slice begins at index 0.
2117+
* @param end The end index of the specified portion of the array. This is exclusive of the element at the index 'end'.
2118+
* If end is undefined, then the slice extends to the end of the array.
2119+
*/
2120+
slice(start?: number, end?: number): PathNiceArr;
2121+
/**
2122+
* Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
2123+
* @param start The zero-based location in the array from which to start removing elements.
2124+
* @param deleteCount The number of elements to remove.
2125+
* @returns An array containing the elements that were deleted.
2126+
*/
2127+
splice(start: number, deleteCount?: number): PathNiceArr;
2128+
/**
2129+
* Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
2130+
* @param start The zero-based location in the array from which to start removing elements.
2131+
* @param deleteCount The number of elements to remove.
2132+
* @param items Elements to insert into the array in place of the deleted elements.
2133+
* @returns An array containing the elements that were deleted.
2134+
*/
2135+
splice(start: number, deleteCount: number, ...items: PathNice[]): PathNiceArr;
2136+
/**
2137+
* Returns the elements of an array that meet the condition specified in a callback function.
2138+
* @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.
2139+
* @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
2140+
*/
2141+
filter(
2142+
predicate: (value: PathNice, index: number, array: PathNice[]) => unknown,
2143+
thisArg?: any,
2144+
): PathNiceArr;
2145+
}

0 commit comments

Comments
 (0)