@lcap/nasl
Version:
NetEase Application Specific Language
54 lines • 1.92 kB
TypeScript
import type { BaseNode, TypeAnnotation, App, SyntaxNode } from '../concepts';
export declare function findClosestModule(node: BaseNode): BaseNode;
/**
* 用 lodash 的 throttle 好像有点问题,先临时做个处理
* @param func
* @param wait
* @param options
*/
export declare const throttle: (func: Function, wait: number, options: any) => Function;
export declare function clearObject(obj: any): void;
export declare function clearObjectDeep(obj: any): void;
export declare const waitPromise: (wait: number) => Promise<unknown>;
export declare const officialCustoms: string[];
export type IfEquals<X, Y, A, B> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? A : B;
export type WritableKeysOf<T> = {
[P in keyof T]: IfEquals<{
[Q in P]: T[P];
}, {
-readonly [Q in P]: T[P];
}, P, never>;
}[keyof T];
export type WritablePart<T> = Pick<T, WritableKeysOf<T>>;
export type NoReadonly<T> = {
-readonly [P in keyof T]: T[P];
};
export declare function replaceNode(oldNode: any, newNode: any): void;
export declare class AnonymousFnNode {
node: SyntaxNode;
descendants: AnonymousFnNode[];
}
/**
* 父链上存在的参数名字
* @returns
*/
export declare function getAncestorExistingParamNames(baseNode: SyntaxNode): Set<string>;
/**
* 父链上存在的变量名字
* @returns
*/
export declare function getAncestorExistingVarNames(baseNode: SyntaxNode): Set<string>;
/**
* 校验匿名函数的局部变量是否重名
*/
export declare function checkParamNameOfAnonymousFunction(node: SyntaxNode): void;
/**
* 新的参数名是否存在同名
* @param param0
*/
export declare function hasParamNameOfAnonymousFunction({ node, newName, }: {
node: SyntaxNode;
newName: string;
}): boolean;
export declare function transformUnionTypeAnnotation(expTypeAnnotation: TypeAnnotation, app: App): void;
//# sourceMappingURL=node.d.ts.map