From 02d1d12fa24dc1ee002d6a5a74c49aa8abd5a420 Mon Sep 17 00:00:00 2001 From: dengxinyu Date: Mon, 4 Dec 2023 07:51:00 +0000 Subject: [PATCH] Remove Declaration Comments Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/I8MW4D Signed-off-by: dengxinyu Change-Id: I6ba398b097060126e0cf15ed80c70511db7af965 --- arkguard/scripts/execute_result_statistics.js | 4 +- arkguard/src/ArkObfuscator.ts | 16 +++- arkguard/src/configs/IOptions.ts | 6 ++ .../grammar/removeComments/obfConfig.json | 37 ++++++++++ .../removeComments/removeComments1.d.ts | 57 ++++++++++++++ .../removeComments1_expected.txt | 40 ++++++++++ .../removeComments/removeComments2.d.ts | 62 ++++++++++++++++ .../removeComments2_expected.txt | 33 +++++++++ .../removeComments/removeComments3.d.ts | 40 ++++++++++ .../removeComments3_expected.txt | 27 +++++++ .../removeComments/removeComments4.d.ts | 55 ++++++++++++++ .../removeComments4_expected.txt | 35 +++++++++ .../removeComments/removeComments5.d.ts | 74 +++++++++++++++++++ .../removeComments5_expected.txt | 41 ++++++++++ .../removeComments/removeComments6.d.ts | 60 +++++++++++++++ .../removeComments6_expected.txt | 38 ++++++++++ 16 files changed, 620 insertions(+), 5 deletions(-) create mode 100644 arkguard/test/grammar/removeComments/obfConfig.json create mode 100644 arkguard/test/grammar/removeComments/removeComments1.d.ts create mode 100644 arkguard/test/grammar/removeComments/removeComments1_expected.txt create mode 100644 arkguard/test/grammar/removeComments/removeComments2.d.ts create mode 100644 arkguard/test/grammar/removeComments/removeComments2_expected.txt create mode 100644 arkguard/test/grammar/removeComments/removeComments3.d.ts create mode 100644 arkguard/test/grammar/removeComments/removeComments3_expected.txt create mode 100644 arkguard/test/grammar/removeComments/removeComments4.d.ts create mode 100644 arkguard/test/grammar/removeComments/removeComments4_expected.txt create mode 100644 arkguard/test/grammar/removeComments/removeComments5.d.ts create mode 100644 arkguard/test/grammar/removeComments/removeComments5_expected.txt create mode 100644 arkguard/test/grammar/removeComments/removeComments6.d.ts create mode 100644 arkguard/test/grammar/removeComments/removeComments6_expected.txt diff --git a/arkguard/scripts/execute_result_statistics.js b/arkguard/scripts/execute_result_statistics.js index 455ef20339..cba6d2f7ce 100644 --- a/arkguard/scripts/execute_result_statistics.js +++ b/arkguard/scripts/execute_result_statistics.js @@ -117,8 +117,8 @@ if (failureCount > 0) { } } -console.log(`Content fomparison success count: ${contentcomparationSuccessCount}`); -console.log(`Content fomparison sailure count: ${contentcomparationFailureCount}`); +console.log(`Content comparison Success count: ${contentcomparationSuccessCount}`); +console.log(`Content comparison Failure count: ${contentcomparationFailureCount}`); if (contentcomparationFailureCount > 0) { console.log('Content comparision failed files:'); for (const failedFile of contentComparisionFailureFiles) { diff --git a/arkguard/src/ArkObfuscator.ts b/arkguard/src/ArkObfuscator.ts index 1dc113334a..f2dfa693f6 100644 --- a/arkguard/src/ArkObfuscator.ts +++ b/arkguard/src/ArkObfuscator.ts @@ -276,10 +276,11 @@ export class ArkObfuscator { public createObfsPrinter(isDeclarationFile: boolean): Printer { // set print options let printerOptions: PrinterOptions = {}; - if (this.mCustomProfiles.mRemoveComments && !isDeclarationFile) { - printerOptions.removeComments = true; + if (this.mCustomProfiles.mRemoveComments || (this.mCustomProfiles.mRemoveDeclarationComments && + (this.mCustomProfiles.mRemoveDeclarationComments.mEnable && !this.mCustomProfiles.mRemoveDeclarationComments.mReservedComments))) { + printerOptions.removeComments = false; } - + printerOptions.removeComments = false; return createPrinter(printerOptions); } @@ -370,6 +371,15 @@ export class ArkObfuscator { orignalFilePathForSearching = originalFilePath ? originalFilePath : ast.fileName; } + if (!this.mCustomProfiles.mRemoveDeclarationComments || !this.mCustomProfiles.mRemoveDeclarationComments.mEnable){ + //@ts-ignore + ast.reservedComments = undefined; + } else { + //@ts-ignore + ast.reservedComments ??= this.mCustomProfiles.mRemoveDeclarationComments.mReservedComments ? + this.mCustomProfiles.mRemoveDeclarationComments.mReservedComments : []; + } + let transformedResult: TransformationResult = transform(ast, this.mTransformers, this.mCompilerOptions); ast = transformedResult.transformed[0] as SourceFile; diff --git a/arkguard/src/configs/IOptions.ts b/arkguard/src/configs/IOptions.ts index 0f49047619..ac750c634c 100644 --- a/arkguard/src/configs/IOptions.ts +++ b/arkguard/src/configs/IOptions.ts @@ -22,6 +22,12 @@ export interface IOptions { // Whether to remove comments; readonly mRemoveComments?: boolean; + // Whether to remove JSDoc comments; + readonly mRemoveDeclarationComments?: { + readonly mEnable: boolean, + mReservedComments: string[] + }; + // Whether to disable console output readonly mDisableConsole?: boolean; diff --git a/arkguard/test/grammar/removeComments/obfConfig.json b/arkguard/test/grammar/removeComments/obfConfig.json new file mode 100644 index 0000000000..c3d2bb0f37 --- /dev/null +++ b/arkguard/test/grammar/removeComments/obfConfig.json @@ -0,0 +1,37 @@ +{ + "mCompact": false, + "mRemoveComments": false, + "mOutputDir": "../../local", + "mDisableHilog": false, + "mDisableConsole": false, + "mSimplify": false, + "mNameObfuscation": { + "mEnable": false, + "mNameGeneratorType": 1, + "mDictionaryList": [], + "mReservedNames": [], + "mRenameProperties": false, + "mReservedProperties": [], + "mKeepStringProperty": true + }, + "mRemoveDeclarationComments": { + "mEnable": true, + "mReservedComments": [ + "add", + "multiply", + "calculateArea", + "capitalizeFirstLetter", + "StringTypeChecker", + "assertTruthyString", + "concatenateStrings", + "isEven", + "add", + "greet", + "myFunction", + "myProperty" + ] + }, + "mEnableSourceMap": false, + "mEnableNameCache": false, + "mTopLevel": false +} \ No newline at end of file diff --git a/arkguard/test/grammar/removeComments/removeComments1.d.ts b/arkguard/test/grammar/removeComments/removeComments1.d.ts new file mode 100644 index 0000000000..3c83f9fd82 --- /dev/null +++ b/arkguard/test/grammar/removeComments/removeComments1.d.ts @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * A namespace for mathematical operations. + * @namespace + */ +declare namespace MathOperations { + /** + * Adds two numbers. + * @param {number} a - The first number. + * @param {number} b - The second number. + * @returns {number} The sum of a and b. + */ + function add(a: number, b: number): number; + + /** + * Multiplies two numbers. + * @param {number} a - The first number. + * @param {number} b - The second number. + * @returns {number} The product of a and b. + */ + function multiply(a: number, b: number): number; +} + +/** + * A type representing a callback function. + * @typedef {function} CallbackFunction + * @param {string} result - The result parameter. + */ +type CallbackFunction = (result: string) => void; + +/** + * An enum representing days of the week. + * @enum {string} + */ +declare enum DaysOfWeek { + Sunday = "Sunday", + Monday = "Monday", + Tuesday = "Tuesday", + Wednesday = "Wednesday", + Thursday = "Thursday", + Friday = "Friday", + Saturday = "Saturday", +} diff --git a/arkguard/test/grammar/removeComments/removeComments1_expected.txt b/arkguard/test/grammar/removeComments/removeComments1_expected.txt new file mode 100644 index 0000000000..3e2ca8d40b --- /dev/null +++ b/arkguard/test/grammar/removeComments/removeComments1_expected.txt @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +declare namespace MathOperations { + /** + * Adds two numbers. + * @param {number} a - The first number. + * @param {number} b - The second number. + * @returns {number} The sum of a and b. + */ + function add(a: number, b: number): number; + /** + * Multiplies two numbers. + * @param {number} a - The first number. + * @param {number} b - The second number. + * @returns {number} The product of a and b. + */ + function multiply(a: number, b: number): number; +} +type CallbackFunction = (result: string) => void; +declare enum DaysOfWeek { + Sunday = "Sunday", + Monday = "Monday", + Tuesday = "Tuesday", + Wednesday = "Wednesday", + Thursday = "Thursday", + Friday = "Friday", + Saturday = "Saturday" +} diff --git a/arkguard/test/grammar/removeComments/removeComments2.d.ts b/arkguard/test/grammar/removeComments/removeComments2.d.ts new file mode 100644 index 0000000000..05617073a3 --- /dev/null +++ b/arkguard/test/grammar/removeComments/removeComments2.d.ts @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * A generic stack class. + * @template T - The type of elements in the stack. + */ +declare class Stack { + /** + * Constructor for Stack. + */ + constructor(); + + /** + * Pushes an element onto the stack. + * @param {T} element - The element to push. + */ + push(element: T): void; + + /** + * Pops an element from the stack. + * @returns {T} The popped element. + */ + pop(): T; + + /** + * Gets the size of the stack. + * @returns {number} The size of the stack. + */ + size(): number; +} + +/** + * An interface representing a geometric shape. + * @interface + */ +declare interface GeometricShape { + /** + * Calculates the area of the shape. + * @returns {number} The area of the shape. + */ + calculateArea(): number; +} + +/** + * A function to capitalize the first letter of a string. + * @param {string} str - The input string. + * @returns {string} The capitalized string. + */ +declare function capitalizeFirstLetter(str: string): string; diff --git a/arkguard/test/grammar/removeComments/removeComments2_expected.txt b/arkguard/test/grammar/removeComments/removeComments2_expected.txt new file mode 100644 index 0000000000..8b6ae3926e --- /dev/null +++ b/arkguard/test/grammar/removeComments/removeComments2_expected.txt @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +declare class Stack { + constructor(); + push(element: T): void; + pop(): T; + size(): number; +} +declare interface GeometricShape { + /** + * Calculates the area of the shape. + * @returns {number} The area of the shape. + */ + calculateArea(): number; +} +/** + * A function to capitalize the first letter of a string. + * @param {string} str - The input string. + * @returns {string} The capitalized string. + */ +declare function capitalizeFirstLetter(str: string): string; diff --git a/arkguard/test/grammar/removeComments/removeComments3.d.ts b/arkguard/test/grammar/removeComments/removeComments3.d.ts new file mode 100644 index 0000000000..afd4871e16 --- /dev/null +++ b/arkguard/test/grammar/removeComments/removeComments3.d.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * A custom error class for a specific application error. + * @class + * @extends {Error} + */ +declare class MyAppError extends Error { + /** + * Constructor for MyAppError. + * @param {string} message - The error message. + * @param {string} errorCode - The error code. + */ + constructor(message: string, errorCode: string); +} + +/** + * A conditional type based on the type of a value. + * @typedef {T extends string ? "StringType" : "NonStringType"} StringTypeChecker + */ + +/** + * An assertion function to assert that a value is a truthy string. + * @param {any} value - The value to assert. + * @returns {asserts value is string} - The asserted truthy string. + */ +declare function assertTruthyString(value: any): asserts value is string; diff --git a/arkguard/test/grammar/removeComments/removeComments3_expected.txt b/arkguard/test/grammar/removeComments/removeComments3_expected.txt new file mode 100644 index 0000000000..1483e02f6f --- /dev/null +++ b/arkguard/test/grammar/removeComments/removeComments3_expected.txt @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +declare class MyAppError extends Error { + constructor(message: string, errorCode: string); +} +/** + * A conditional type based on the type of a value. + * @typedef {T extends string ? "StringType" : "NonStringType"} StringTypeChecker + */ +/** + * An assertion function to assert that a value is a truthy string. + * @param {any} value - The value to assert. + * @returns {asserts value is string} - The asserted truthy string. + */ +declare function assertTruthyString(value: any): asserts value is string; diff --git a/arkguard/test/grammar/removeComments/removeComments4.d.ts b/arkguard/test/grammar/removeComments/removeComments4.d.ts new file mode 100644 index 0000000000..baa699d2f7 --- /dev/null +++ b/arkguard/test/grammar/removeComments/removeComments4.d.ts @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * A simple utility class. + */ +declare class Utility { + /** + * Constructor for Utility. + */ + constructor(); + + /** + * Concatenates two strings. + * @param {string} str1 - The first string. + * @param {string} str2 - The second string. + * @returns {string} The concatenated string. + */ + concatenateStrings(str1: string, str2: string): string; + + /** + * A method to check if a number is even. + * @param {number} num - The number to check. + * @returns {boolean} True if the number is even, false otherwise. + */ + isEven(num: number): boolean; +} + +/** + * An interface representing a user profile. + * @interface + */ +declare interface UserProfile { + username: string; + age: number; +} + +/** + * A function to greet a user. + * @param {UserProfile} user - The user profile. + * @returns {string} A personalized greeting. + */ +declare function greetUser(user: UserProfile): string; diff --git a/arkguard/test/grammar/removeComments/removeComments4_expected.txt b/arkguard/test/grammar/removeComments/removeComments4_expected.txt new file mode 100644 index 0000000000..e7660a1a31 --- /dev/null +++ b/arkguard/test/grammar/removeComments/removeComments4_expected.txt @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +declare class Utility { + constructor(); + /** + * Concatenates two strings. + * @param {string} str1 - The first string. + * @param {string} str2 - The second string. + * @returns {string} The concatenated string. + */ + concatenateStrings(str1: string, str2: string): string; + /** + * A method to check if a number is even. + * @param {number} num - The number to check. + * @returns {boolean} True if the number is even, false otherwise. + */ + isEven(num: number): boolean; +} +declare interface UserProfile { + username: string; + age: number; +} +declare function greetUser(user: UserProfile): string; diff --git a/arkguard/test/grammar/removeComments/removeComments5.d.ts b/arkguard/test/grammar/removeComments/removeComments5.d.ts new file mode 100644 index 0000000000..0cb20004ec --- /dev/null +++ b/arkguard/test/grammar/removeComments/removeComments5.d.ts @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * This is a sample class. + */ +declare class MyClass { + name: string; + + /** + * Constructor for MyClass. + * @param {string} name - The name parameter. + */ + constructor(name: string); + + /** + * A simple function. + * @param {number} x - The first number. + * @param {number} y - The second number. + * @returns {number} The sum of x and y. + */ + add(x: number, y: number): number; + + /** + * A method that greets. + * @param {string} greeting - The greeting message. + */ + greet(greeting: string): void; +} + +/** + * A simple function declaration. + * @param {string} message - The message parameter. + * @returns {string} The formatted message. + */ +declare function formatMessage(message: string): string; + +/** + * An interface representing a point. + * @interface + */ +declare interface Point { + x: number; + y: number; +} + +/** + * A type alias for a callback function. + * @typedef {function} Callback + * @param {string} result - The result parameter. + */ +type Callback = (result: string) => void; + +/** + * An enumeration of colors. + * @enum {string} + */ +declare enum Color { + Red = "RED", + Green = "GREEN", + Blue = "BLUE", +} diff --git a/arkguard/test/grammar/removeComments/removeComments5_expected.txt b/arkguard/test/grammar/removeComments/removeComments5_expected.txt new file mode 100644 index 0000000000..019b8373ca --- /dev/null +++ b/arkguard/test/grammar/removeComments/removeComments5_expected.txt @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +declare class MyClass { + name: string; + constructor(name: string); + /** + * A simple function. + * @param {number} x - The first number. + * @param {number} y - The second number. + * @returns {number} The sum of x and y. + */ + add(x: number, y: number): number; + /** + * A method that greets. + * @param {string} greeting - The greeting message. + */ + greet(greeting: string): void; +} +declare function formatMessage(message: string): string; +declare interface Point { + x: number; + y: number; +} +type Callback = (result: string) => void; +declare enum Color { + Red = "RED", + Green = "GREEN", + Blue = "BLUE" +} diff --git a/arkguard/test/grammar/removeComments/removeComments6.d.ts b/arkguard/test/grammar/removeComments/removeComments6.d.ts new file mode 100644 index 0000000000..94bf417175 --- /dev/null +++ b/arkguard/test/grammar/removeComments/removeComments6.d.ts @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * A variable declaration. + * @type {string} + */ +declare let myVariable: string; + +/** + * A function with parameter declarations. + * @param {number} x - The first parameter. + * @param {string} y - The second parameter. + */ +declare function myFunction(x: number, y: string): void; + +/** + * An interface with a property signature. + * @interface + */ +declare interface MyInterface { + myProperty: number; +} + +/** + * A class with get and set accessor declarations. + * @class + */ +declare class MyClass { + private _myProperty: number; + + /** + * Get accessor for myProperty. + * @returns {number} The value of myProperty. + */ + get myProperty(): number; + + /** + * Set accessor for myProperty. + * @param {number} value - The value to set. + */ + set myProperty(value: number); + + /** + * A static block in the class. + */ + static {} +} diff --git a/arkguard/test/grammar/removeComments/removeComments6_expected.txt b/arkguard/test/grammar/removeComments/removeComments6_expected.txt new file mode 100644 index 0000000000..a2c0225370 --- /dev/null +++ b/arkguard/test/grammar/removeComments/removeComments6_expected.txt @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +declare let myVariable: string; +/** + * A function with parameter declarations. + * @param {number} x - The first parameter. + * @param {string} y - The second parameter. + */ +declare function myFunction(x: number, y: string): void; +declare interface MyInterface { + myProperty: number; +} +declare class MyClass { + private _myProperty: number; + /** + * Get accessor for myProperty. + * @returns {number} The value of myProperty. + */ + get myProperty(): number; + /** + * Set accessor for myProperty. + * @param {number} value - The value to set. + */ + set myProperty(value: number); + static {} +} -- Gitee