Skip to content

Commit

Permalink
fix: 类型声明问题
Browse files Browse the repository at this point in the history
  • Loading branch information
wangYP committed Apr 9, 2021
1 parent 3cac0a8 commit 6383ebf
Showing 1 changed file with 47 additions and 8 deletions.
55 changes: 47 additions & 8 deletions src/main.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,54 @@ interface arrToTreeDataType {
id: number;
parentId: number;
}

interface objectType {
[key: string]: string;
}

declare class RecursionHalle {
getName(id: number): string
export default class RecursionHalle {
/** 获取树结构数据某一个键值 */
convertData(testData: uniteObject[], selEle: string): string[];

/** 将一维数组转化为树结构类型数据 */
arrToTreeData(arrToTreeDataType): uniteObject;

/** 获得树结构类型数据的路径 */
nodePath(
originData: uniteObject[],
keyName: string,
customSymbol: string
): string[];

/** 获取节点的子节点 */
getChildNode(
originData: uniteObject[],
keyName: string,
nodeName: string
): objectType;

/** 为每个节点插入属性 */
insertAttr(originData: uniteObject[], insertObj: objectType): uniteObject;

/** 为节点替换键名 */
replaceKeyName(
originData: uniteObject[],
replaceObj: objectType
): uniteObject[];

/** 获得节点的个数 */
getnodeCount(testData: uniteObject[]): number;

/** 一维化数据 */
downGradeData(
originData: uniteObject[],
idValue: string,
): any[];

/** 去重并去除undefined */
delUndefined(inCome: string[]): string[];

/** 对象替换键名 */
renameKeys(keysMap: objectType, obj: objectType): objectType;
}

export declare namespace treeRecursionHalle {
Expand Down Expand Up @@ -47,7 +88,7 @@ export declare namespace treeRecursionHalle {
function replaceKeyName(
originData: uniteObject[],
replaceObj: objectType
): uniteObject;
): uniteObject[];

/** 获得节点的个数 */
function getnodeCount(testData: uniteObject[]): number;
Expand All @@ -56,12 +97,10 @@ export declare namespace treeRecursionHalle {
function downGradeData(
originData: uniteObject[],
idValue: string,
parentValue: string,
accTemp: uniteObject[]
): number;
): any[];

/** 去重并去除undefined */
function delUndefined(inCome: string[]): string[];
function delUndefined(inCome: any[]): string[];

/** 对象替换键名 */
function renameKeys(keysMap: objectType, obj: objectType): objectType;
Expand Down

0 comments on commit 6383ebf

Please sign in to comment.