1/* 2 * Copyright (c) 2022-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 PropDecorator = (target: any, propertyKey: any) => void; 17type PropDecoratorCall = ((val: string) => PropDecorator); 18type PropDecoratorWithCall = PropDecorator & PropDecoratorCall; 19 20let Builder: PropDecorator; 21let BuilderParam: PropDecorator; 22let Component: PropDecorator = (x, y) => {}; 23let Consume: PropDecoratorWithCall; 24let Entry: PropDecoratorWithCall = () => ((x, y) => {}); 25let Link: PropDecorator; 26let LocalStorageLink: PropDecoratorCall; 27let LocalStorageProp: PropDecoratorCall; 28let ObjectLink: PropDecorator; 29let Observed: PropDecorator = (x, y) => {}; 30let Prop: PropDecorator; 31let Provide: PropDecoratorWithCall; 32let State: PropDecorator; 33let StorageLink: PropDecoratorCall; 34let StorageProp: PropDecoratorCall; 35let Styles: PropDecorator; 36let Watch: PropDecoratorCall; 37let Concurrent: PropDecorator = (x, y) => {}; 38 39let InvalidDecorator: PropDecorator = (x, y) => {}; 40let InvalidDecoratorWithCall: PropDecoratorWithCall = () => ((x, y) => {}); 41 42@Observed class Person { 43 name: string; 44 age: number; 45} 46 47@Component 48class PersonView { 49 @BuilderParam 50 builderParam: number; 51 52 @Consume 53 @Consume('1') 54 consume: string; 55 56 @Link 57 link: number; 58 59 @LocalStorageLink('2') 60 @LocalStorageProp('3') 61 localStorage: string; 62 63 @ObjectLink 64 objLink: string; 65 66 @Prop 67 prop: string; 68 69 @Provide 70 @Provide('4') 71 provide: number; 72 73 @State 74 state: number; 75 76 @StorageLink('5') 77 @StorageProp('6') 78 storage: string; 79 80 @Styles 81 style: string; 82 83 @Watch('7') 84 watch: number; 85 86 @Builder 87 foo() {} 88} 89 90@Entry 91@Component 92class PageEntry { 93 @InvalidDecorator 94 invalid: string; 95 96 @Builder 97 @InvalidDecoratorWithCall('10') 98 bar() {} 99} 100 101@InvalidDecorator 102class C {} 103 104@Concurrent 105class ConcurrentArray { 106 data: Object[]; 107}