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// destructuring declaration + untyped object literal 17interface GeneratedObjectLiteralInterface_2 { 18 a: number; 19 b: number; 20} 21let GeneratedDestructObj_1: GeneratedObjectLiteralInterface_2 = { a: 1, b: 2 }; 22let a = GeneratedDestructObj_1.a; 23let b = GeneratedDestructObj_1.b; 24 25 26// destructuring declaration + untyped object literal + type literal 27interface GeneratedTypeLiteralInterface_1 { 28 c2: number; 29 d2: string; 30} 31interface GeneratedObjectLiteralInterface_3 { 32 a2: number; 33 b2: GeneratedTypeLiteralInterface_1; 34} 35let GeneratedDestructObj_2: GeneratedObjectLiteralInterface_3 = { 36 a2: 1, 37 b2: { 38 c2: 1, 39 d2: '2' 40 } as GeneratedTypeLiteralInterface_1 41}; 42let a2 = GeneratedDestructObj_2.a2; 43let b2 = GeneratedDestructObj_2.b2; 44 45 46// untyped object literal + 'in' operator 47interface GeneratedObjectLiteralInterface_1 { 48 a: number; 49 b: number; 50} 51console.log('a' in ({ a: 1, b: 2 } as GeneratedObjectLiteralInterface_1)); 52 53// untyped object literal + var declaration + literal as property name + function expression 54interface GeneratedObjectLiteralInterface_4 { 55 x1: number; 56 x2: number; 57} 58let fun = () => { 59 let o = { 60 'a': 1, 61 'b': 2 62}; 63 let o2 = { 64 'c': 3, 65 'd': 4, 66 5: ({ x1: 10, 67 x2: 20 } as GeneratedObjectLiteralInterface_4) 68}; 69}; 70 71// private identifier + definite assignment 72class A { 73 private a!: number; 74} 75 76// type assertion + as 'const' 77const t = <const> 'hello';