1/* 2 * Copyright (c) 2024-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 16function main(): void { 17 let union1: (A1 | A2 | A3 | A4 | A5); 18 let union2: (B5 | B4 | B3 | B2 | B1); 19 let union3: (A1 | B5 | A2 | B4 | A3 | B3 | A4 | B2 | A5 | B1); 20 let union4: (A1 | B5 | A2 | B4 | A3 | object | B3 | A4 | B2 | A5 | B1); 21 22 union1 = new A1(); 23 union2 = new B1(); 24 union3 = new A1(); 25 union3 = new B1(); 26 union4 = new Object(); 27} 28 29class A1 {} 30class A2 extends A1 {} 31class A3 extends A2 {} 32class A4 extends A3 {} 33class A5 extends A4 {} 34 35class B1 {} 36class B2 extends B1 {} 37class B3 extends B2 {} 38class B4 extends B3 {} 39class B5 extends B4 {}