1/* 2 * Copyright (c) 2023-2024 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 16type T = () => void 17 18class A { 19 foo?: T 20 bar?: Function 21} 22 23let a: A = { 24 foo: () => { 25 console.log("Hello") 26 }, 27 bar: () => { 28 console.log("Hello") 29 } 30} 31 32//====================== 33class Resource{} 34 35class ContainerModuleItem { 36 groupName: string = ""; 37 moduleName: Resource | null = null; 38 atributeList: string[] = []; 39} 40 41const FLEX_MODULE: ContainerModuleItem[] = [{ 42 groupName: GROUP.MAIN_DIRECTION, 43 moduleName: "ASF", 44 atributeList: [ATTRIBUTE.COLUMN, ATTRIBUTE.ROW, ATTRIBUTE.COLUMN_REVERSE], 45}] 46 47const enum ATTRIBUTE { 48 ROW = 'Row', 49 COLUMN = 'Column', 50 COLUMN_REVERSE = 'ColumnReverse' 51} 52 53const enum GROUP { 54 MAIN_DIRECTION = 'MAIN_DIRECTION' 55} 56 57//==================================== 58 59class C { 60 s: string = "" 61 n: number = 0 62 l: () => void = () => {} 63} 64 65let c : C = { 66 s: "foo", 67 n: 42, 68 l: () => { 69 console.log("Hi") 70 } 71} 72 73c.l()