diff --git a/src/Utils.ts b/src/Utils.ts index ad3a5b89..95f008a2 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -17,15 +17,15 @@ export class Utils { * @param array * @param times * @param reverse - * @returns any[] + * @returns {T[]} */ - public static arrayRotate (array: any[], times: number, reverse: boolean = false): any[] { + public static arrayRotate (array: T[], times: number, reverse: boolean = false): T[] { if (times < 0) { return; } - let newArray: any[] = array, - temp: any; + let newArray: T[] = array, + temp: T; while (times--) { if (!reverse) { diff --git a/src/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.ts b/src/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.ts index ea139c6f..c704c5f1 100644 --- a/src/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.ts +++ b/src/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.ts @@ -1,5 +1,7 @@ import * as esprima from 'esprima'; +import { INode } from "../../interfaces/nodes/INode"; + import { TBlockScopeNode } from "../../types/TBlockScopeNode"; import { Node } from '../Node'; @@ -33,9 +35,9 @@ export class ConsoleOutputDisableExpressionNode extends Node { * _console * })(); * - * @returns any + * @returns {INode} */ - protected getNodeStructure (): any { + protected getNodeStructure (): INode { return NodeUtils.getBlockScopeNodeByIndex( esprima.parse(` (function () { diff --git a/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionCallNode.ts b/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionCallNode.ts index 605b48ef..f14d02f7 100644 --- a/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionCallNode.ts +++ b/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionCallNode.ts @@ -1,3 +1,5 @@ +import { IExpressionStatementNode } from "../../interfaces/nodes/IExpressionStatementNode"; + import { TBlockScopeNode } from "../../types/TBlockScopeNode"; import { NodeType } from "../../enums/NodeType"; @@ -30,9 +32,9 @@ export class DebugProtectionFunctionCallNode extends Node { } /** - * @returns any + * @returns {IExpressionStatementNode} */ - protected getNodeStructure (): any { + protected getNodeStructure (): IExpressionStatementNode { return { 'type': NodeType.ExpressionStatement, 'expression': { diff --git a/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionIntervalNode.ts b/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionIntervalNode.ts index c713bddb..173ff8b3 100644 --- a/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionIntervalNode.ts +++ b/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionIntervalNode.ts @@ -1,3 +1,5 @@ +import { IExpressionStatementNode } from "../../interfaces/nodes/IExpressionStatementNode"; + import { TBlockScopeNode } from "../../types/TBlockScopeNode"; import { NodeType } from '../../enums/NodeType'; @@ -30,9 +32,9 @@ export class DebugProtectionFunctionIntervalNode extends Node { } /** - * @returns any + * @returns {IExpressionStatementNode} */ - protected getNodeStructure (): any { + protected getNodeStructure (): IExpressionStatementNode { return { 'type': NodeType.ExpressionStatement, 'expression': { diff --git a/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts b/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts index 09062715..d95dcbd0 100644 --- a/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts +++ b/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts @@ -1,5 +1,7 @@ import * as esprima from 'esprima'; +import { INode } from "../../interfaces/nodes/INode"; + import { TBlockScopeNode } from "../../types/TBlockScopeNode"; import { Node } from '../Node'; @@ -45,9 +47,9 @@ export class DebugProtectionFunctionNode extends Node { /** * Found this trick in JScrambler * - * @returns any + * @returns {INode} */ - protected getNodeStructure (): any { + protected getNodeStructure (): INode { return NodeUtils.getBlockScopeNodeByIndex( esprima.parse(` var ${this.debugProtectionFunctionName} = function () { diff --git a/src/custom-nodes/unicode-array-nodes/UnicodeArrayCallsWrapper.ts b/src/custom-nodes/unicode-array-nodes/UnicodeArrayCallsWrapper.ts index 3fc9fca6..08b84b47 100644 --- a/src/custom-nodes/unicode-array-nodes/UnicodeArrayCallsWrapper.ts +++ b/src/custom-nodes/unicode-array-nodes/UnicodeArrayCallsWrapper.ts @@ -76,9 +76,9 @@ export class UnicodeArrayCallsWrapper extends Node { } /** - * @returns any + * @returns {INode} */ - protected getNodeStructure (): any { + protected getNodeStructure (): INode { let keyName: string = Utils.getRandomVariableName(), node: INode = esprima.parse(` var ${this.unicodeArrayCallsWrapperName} = function (${keyName}) { diff --git a/src/custom-nodes/unicode-array-nodes/UnicodeArrayNode.ts b/src/custom-nodes/unicode-array-nodes/UnicodeArrayNode.ts index a5bfb9d3..655c6f40 100644 --- a/src/custom-nodes/unicode-array-nodes/UnicodeArrayNode.ts +++ b/src/custom-nodes/unicode-array-nodes/UnicodeArrayNode.ts @@ -10,6 +10,7 @@ import { NodeType } from "../../enums/NodeType"; import { Node } from '../Node'; import { NodeUtils } from "../../NodeUtils"; import { Utils } from '../../Utils'; +import {IVariableDeclarationNode} from "../../interfaces/nodes/IVariableDeclarationNode"; export class UnicodeArrayNode extends Node { /** @@ -79,7 +80,7 @@ export class UnicodeArrayNode extends Node { return; } - Utils.arrayRotate(this.unicodeArray, this.unicodeArrayRotateValue); + Utils.arrayRotate (this.unicodeArray, this.unicodeArrayRotateValue); this.updateNode(); @@ -87,9 +88,9 @@ export class UnicodeArrayNode extends Node { } /** - * @returns any + * @returns {INode} */ - protected getNodeStructure (): any { + protected getNodeStructure (): IVariableDeclarationNode { return { 'type': NodeType.VariableDeclaration, 'declarations': [ diff --git a/src/custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode.ts b/src/custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode.ts index 822bdb75..5be83b3d 100644 --- a/src/custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode.ts +++ b/src/custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode.ts @@ -69,9 +69,9 @@ export class UnicodeArrayRotateFunctionNode extends Node { } /** - * @returns any + * @returns {INode} */ - protected getNodeStructure (): any { + protected getNodeStructure (): INode { let arrayName: string = Utils.getRandomVariableName(), timesName: string = Utils.getRandomVariableName(), tempArrayName: string = Utils.getRandomVariableName(), diff --git a/src/interfaces/nodes/IExpressionStatementNode.d.ts b/src/interfaces/nodes/IExpressionStatementNode.d.ts new file mode 100644 index 00000000..7774ac1d --- /dev/null +++ b/src/interfaces/nodes/IExpressionStatementNode.d.ts @@ -0,0 +1,5 @@ +import { INode } from "./INode"; + +export interface IExpressionStatementNode extends INode { + expression: any; +}