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 16interface I { 17 arr 18} 19 20function foo (bar: Partial<I>) { 21 if (bar.var_one != undefined) { 22 bar.var_one = "asddsf"; 23 } 24} 25 26function main() { 27 let a : I = {var_one: "initial_var_one", var_two: "initial_var_two_a"}; 28 foo(a.var_one); 29 let a : I = {var_two: "initial_var_two_b"}; 30 foo(break.var_one); 31} 32 33/* @@? 18:1 Error SyntaxError: Invalid Type. */ 34/* @@? 21:13 Error TypeError: Property 'var_one' does not exist on type 'I$partial' */ 35/* @@? 22:13 Error TypeError: Property 'var_one' does not exist on type 'I$partial' */ 36/* @@? 27:18 Error TypeError: type I has no property named var_one */ 37/* @@? 28:11 Error TypeError: Property 'var_one' does not exist on type 'I' */ 38/* @@? 29:9 Error TypeError: Variable 'a' has already been declared. */ 39/* @@? 29:18 Error TypeError: type I has no property named var_two */ 40/* @@? 30:9 Error SyntaxError: Unexpected token 'break'. */ 41