• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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*/
15import { AsyncCallback, Callback } from './../basic';
16
17declare namespace napitest {
18    interface Human {
19        name: string;
20        age: number;
21    }
22
23    // 变换括号位置
24    interface Man
25    {
26        name: string;
27        age: number;
28    }
29
30    export enum LaunchReason {
31        UNKNOWN = 0,
32        START_ABILITY = 1,
33        CALL = 2,
34        CONTINUATION = 3,
35    }
36
37    interface TestClass1 {
38        ahuman: Human;
39        fun1(v: number): number;
40        fun2(numcc: Array<number>, mancc: Human): Human;
41        fun3: (v: number, v1: string, v2: boolean) => boolean;
42        fun4: (mancc: Map<string, string>,v?: string) => Array<number>;
43        fun5: (data: Array<Human>) => Human;
44        fun6: (v: string[], v1: { [key: string]: boolean }) => string[];
45        fun8: () => void;
46        fun9(manA: Man): void;
47
48        //参数为enum
49        fun12(v: TestStatus): number;
50        fun13(v: TestEnumString): number;
51        fun16(v1: number, v2: string, v3: boolean);
52
53        // return value is enum type of defined later
54        // to support
55        // fun14(v: string): ReturnStatus;
56        // fun15(v: string): ReturnEnumString;
57
58        /*fun7: (v: string, v1: LaunchReason) => LaunchReason;  --待支持*/
59    }
60
61    // 数值型枚举
62    export enum TestStatus {
63        UNKNOWN = 0,
64        START_ABILITY = 1,
65        CALL = 2,
66        CONTINUATION = 3,
67    }
68
69    // 字符型枚举
70    export enum TestEnumString {
71        ACTION_HOME = 'ohos.want.action.home',
72        ACTION_DIAL = 'ohos.want.action.dial',
73        ACTION_SEARCH = 'ohos.want.action.search',
74        ACTION_WIRELESS_SETTINGS = 'ohos.settings.wireless',
75    }
76
77    // 数值型枚举
78    export enum ReturnStatus {
79        UNKNOWN = 0,
80        START_RETURN = 1,
81        MIDDLE_RETURN = 2,
82        END_RETURN = 3,
83    }
84
85    // 字符型枚举
86    export enum ReturnEnumString {
87        RETURN_HOME = 'ohos.want.return.home',
88        RETURN_DIAL = 'ohos.want.return.dial',
89        RETURN_SEARCH = 'ohos.want.return.search',
90        RETURN_WIRELESS_SETTINGS = 'ohos.settings.return.wireless',
91    }
92    interface Test {
93        aa: string;
94        bb?: boolean;
95        cc: number;
96        dd?: string;
97        ee?: number;
98        /* ff?: any; --待支持*/
99        /* gg?: object; --待支持*/
100        /* hh?: LaunchReason; --待支持*/
101    }
102
103    function func1 (v1: Test, v2?: number): string;
104
105    interface ComplexTest {
106        a1: Map<string, number>;
107        b1?: Map<string, string>;
108        c1: Array<number>;
109        d1?: Array<string>;
110        e1?: number | string | boolean;
111        g1?: Test;
112    }
113
114    function func2 (v: ComplexTest): string;
115
116    interface testInterface {
117        a1: number;
118        b1?: string;
119        aa: boolean;
120        bb?: Array<number>;
121        cc?: Map<string, string>;
122        dd: Array<boolean>;
123        ee: Map<string, number>;
124    }
125
126    interface testInterface22 {
127        test: testInterface;
128    }
129
130    function func3(fp1: testInterface22): string;
131
132    // interface定义在使用之后 begin
133    function func4(v: TestInterfaceLater): string;
134
135    interface TestInterfaceUse {
136        v0: string;
137        // v1: TestInterfaceLater;
138        funceUse(n0: TestInterfaceLater): string;
139    }
140
141    interface TestInterfaceLater {
142        v0: string;
143        v1: number;
144        funcLater(n0: number): string;
145    }
146    // interface定义在使用之后 end
147}
148
149export default napitest;
150