1/* 2* Copyright (c) Microsoft Corporation. All rights reserved. 3* Copyright (c) 2023 Huawei Device Co., Ltd. 4* Licensed under the Apache License, Version 2.0 (the "License"); 5* you may not use this file except in compliance with the License. 6* You may obtain a copy of the License at 7* 8* http://www.apache.org/licenses/LICENSE-2.0 9* 10* Unless required by applicable law or agreed to in writing, software 11* distributed under the License is distributed on an "AS IS" BASIS, 12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13* See the License for the specific language governing permissions and 14* limitations under the License. 15* 16* This file has been modified by Huawei to verify type inference by adding verification statements. 17*/ 18 19// === tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/undefinedIsSubtypeOfEverything.ts === 20declare function AssertType(value:any, type:string):void; 21 22// undefined is a subtype of every other types, no errors expected below 23 24class Base { 25 foo: typeof undefined; 26} 27 28class D0 extends Base { 29 foo: any; 30} 31 32class DA extends Base { 33 foo: typeof undefined; 34} 35 36class D1 extends Base { 37 foo: string; 38} 39 40class D1A extends Base { 41 foo: String; 42} 43 44 45class D2 extends Base { 46 foo: number; 47} 48 49class D2A extends Base { 50 foo: Number; 51} 52 53 54class D3 extends Base { 55 foo: boolean; 56} 57 58class D3A extends Base { 59 foo: Boolean; 60} 61 62 63class D4 extends Base { 64 foo: RegExp; 65} 66 67class D5 extends Base { 68 foo: Date; 69} 70 71 72class D6 extends Base { 73 foo: number[]; 74} 75 76class D7 extends Base { 77 foo: { bar: number }; 78} 79 80 81class D8 extends Base { 82 foo: D7; 83} 84 85interface I1 { 86 bar: string; 87} 88class D9 extends Base { 89 foo: I1; 90} 91 92 93class D10 extends Base { 94 foo: () => number; 95} 96 97enum E { A } 98class D11 extends Base { 99 foo: E; 100} 101 102function f() { } 103module f { 104 export let bar = 1; 105} 106class D12 extends Base { 107 foo: typeof f; 108} 109 110 111class c { baz: string } 112module c { 113 export let bar = 1; 114} 115class D13 extends Base { 116 foo: typeof c; 117} 118 119 120class D14<T> extends Base { 121 foo: T; 122} 123 124 125class D15<T, U> extends Base { 126 foo: U; 127} 128 129//class D15<T, U extends T> extends Base { 130// foo: U; 131//} 132 133 134class D16 extends Base { 135 foo: Object; 136} 137 138 139class D17 extends Base { 140 foo: {}; 141} 142 143 144