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 type Plant = { 19 tomato: string; 20 tomatoId: number; 21 isTomato: boolean; 22 // potato?: string; //不支持可选参数 23 // potatoId?: number; 24 // isPotato?: boolean; 25 } 26 27 type Flower = 28 { 29 name: string; 30 Id: number; 31 isMoreFlower: boolean; 32 } 33 34 type MyString = string; 35 type MyNumberType = number; 36 type MyBool = boolean; 37 type MyUnion = string | number | boolean; 38 type MyEnumType = 'keyup' | 'keydown'; 39 40 class Animal { 41 cat: string; 42 isCat: boolean; 43 44 catFunc1(v: MyString): MyString; 45 catFunc2(v: MyNumberType): MyNumberType; 46 catFunc3(v: MyBool): MyBool; 47 catFunc4(v: Plant): string; 48 catFunc5(v: number): Plant; 49 } 50 51 function fun1(v: Plant): number; 52 function fun2(v: boolean): Plant; 53 function fun3(v0: MyString, v1: MyNumberType, v2: MyBool): boolean; 54 function fun4(v: string): MyString; 55 function fun5(v: number): MyNumberType; 56 function fun6(v: boolean): MyBool; 57 function fun7(v: MyUnion): number; 58 function fun8(v: MyEnumType): string; 59 function fun9(v: Flower): string; 60 61 type OptionalTest = 62 { 63 ttt: number; 64 param1?: string; 65 param2?: number; 66 param3?: boolean; 67 param4?: Array<number>; 68 param5?: string[]; 69 param6: Array<boolean>; 70 param7?: Map<string, string>; 71 param8?: {[key: string]: number}; 72 param9: Map<string, boolean>; 73 param10?: boolean | number | string; 74 } 75 76 function fun10(v: OptionalTest): string; 77} 78 79export default napitest; 80 81