• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
16interface itf {
17    f1: ((s: string) => string)
18    f2: ((() => number) | null)
19    f3: (((() => void) | null) | String)
20    f4: (((() => boolean) | null) | String)
21}
22
23class A implements itf {
24    f1 = (s: string): string => {
25        return s
26    }
27    f2 = null
28    f3 = "f3"
29    f4 = (): boolean => {
30        return true;
31    }
32}
33
34
35function main() {
36    let a: A = new A()
37    assertEQ(a.f1("f1"), "f1")
38    assertEQ(a.f2, null)
39    assertEQ(a.f3, "f3")
40    assertEQ(a.f4(), true)
41}
42