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    // Compile-time error with noImplicitAny
17    function f(x: number) {
18        if (x <= 0) {
19            return x
20        }
21        return g(x)
22    }
23
24    // Compile-time error with noImplicitAny
25    function g(x: number) {
26        return f(x - 1)
27    }
28
29    function doOperation(x: number, y: number) {
30        return x + y
31    }
32
33    console.log(f(10))
34    console.log(doOperation(2, 3))
35
36    function f1(x: number) : number {
37        if (x <= 0) {
38            return x
39        }
40        return g1(x)
41    }
42
43    function g1(x: number) {
44        return f1(x - 1)
45    }
46
47    function doOperation1(x: number, y: number) {
48        return x + y
49    }
50
51    console.log(f1(10))
52    console.log(doOperation1(2, 3))
53