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 17let { a, b } = { a: 1, b: 2 }; 18 19// destructuring declaration + untyped object literal + type literal 20let { a2, b2 } = { 21 a2: 1, 22 b2: { 23 c2: 1, 24 d2: '2' 25 } as { c2: number, d2: string } 26}; 27 28// untyped object literal + 'in' operator 29console.log('a' in { a: 1, b: 2 }); 30 31// untyped object literal + var declaration + literal as property name + function expression 32var fun = function() { 33 var o = { 34 'a': 1, 35 'b': 2 36 }; 37 38 var o2 = { 39 'c': 3, 40 'd': 4, 41 5: { 42 x1: 10, 43 x2: 20 44 } 45 }; 46}; 47 48// private identifier + definite assignment 49class A { 50 #a!: number; 51} 52 53// type assertion + as 'const' 54const t = <const> 'hello';