• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16// export namspace/function
17export namespace TestNamespace1 {
18    export function testFunction(num : number) {
19        return num
20    }
21}
22
23//export namespace/class/function
24export namespace TestNamespace2 {
25    export class TestClass1 {
26        value: number
27
28        constructor() {
29            this.value = 0
30        }
31
32        testFunction(num1 : number, num2 : number) {
33            return num1 + num2
34        }
35    }
36}
37
38
39// export class/function
40export class TestClass2 {
41    value: number
42
43    constructor() {
44        this.value = 0
45    }
46
47    testFunction(num1 : number, num2 : number) {
48        return num1 + num2
49    }
50}
51
52// export function
53export function testFunction(num1 : number, num2 : number) {
54    return num1 + num2
55}
56