1/* 2 * Copyright (c) 2023-2024 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// @ts-ignore 17let x: number = null; // No error, type checking is suppressed 18let y: number = null; // Compile-time error 19 20if (false) { 21 /* @ts-ignore: Unreachable code error */ 22 console.log("hello"); 23} 24 25let a: number = 0 // @ts-ignore: suppresses CTE for the next line 26let b: number = null; 27 28 29 30 // @ts-expect-error 31console.log("Hello" * 42); 32 33 /* 34 @ts-expect-error (shouldn't be reported) 35*/ 36console.log("Hello" * 42); 37 38// no @ts-expect-error (shouldn't be reported) 39console.log("Hello" * 42); 40 41const l1 = (): void => { 42 let l2 = () => { 43 // @ts-expect-error 44 console.log("Hello" * 42); 45 } 46 l2(); 47} 48 49l1(); 50 51class SomeClass { 52 // @ts-ignore 53 static readonly m1; 54 55 methodError(param: any) { 56 // @ts-expect-error 57 console.log("Hello" * param); 58 // @ts-ignore 59 let nns: String = null; 60 } 61} 62 63class ChainedCallsClass { 64 methodOne(): ChainedCallsClass { 65 return this; 66 } 67 68 methodTwo(): ChainedCallsClass { 69 return this; 70 } 71} 72 73// Issue 13972 74let cc = new ChainedCallsClass() 75// @ts-ignore 76.methodOne().methodTwo(); 77 78// #14305 79/* 80@ts-ignore (shouldn't be reported) 81 */ 82let c: number = '1'; 83 84/* 85 @ts-ignore (shouldn't be reported) 86 */ 87let d: number = '1';