• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
16export class A {
17  constructor(
18    public onAction?: () => void,
19    public onH?: () => void
20  ) {}
21}
22
23export function f(a: Partial<A>) {}
24export function ff(a: A) {}
25export function foo(func: () => void) {}
26export function bar(func: () => void, a: number, b: string) {}
27
28export class OhosLibC {}
29export interface OhosLibI {}
30export interface OhosLibIC extends OhosLibC {}
31export interface OhosLibII extends OhosLibI {}
32export class OhosLibCC extends OhosLibC {}
33export class OhosLibCI implements OhosLibI {}
34
35export interface OhosI {
36  f: number;
37}
38
39export function ohFunction1({ d: OhosI }): void {} // incorrect usage, but it was an issue, so we check it too
40export function ohFunction2(p: { d: OhosI }): void {}
41
42export function fooOh(): any {}
43export function barOh(a: any) {}
44
45export interface OhosInterface {
46  fld: A & {
47    [key: string]: number;
48  };
49}
50
51export type CallbackType = (name: string, param: unknown) => void;
52
53export const callback = (name: string, param: Object): void => {};
54
55export interface a {
56  test:(topic: string) => void
57}
58
59export function doSomething(a: a, topic: string): void {
60
61}
62
63export class TestClassC {
64  public ccc: null = null;
65}
66
67export class TestClassD {
68  public ccc: string = '';
69}
70
71export class TestClassH {
72  constructor(a: A) {
73  }
74}
75
76export class TestClassI {
77  constructor(a: a, topic: string) {
78  }
79}
80
81export class TestClassJ {
82  constructor(func: () => void) {
83  }
84}
85
86export class TestClassK {
87  constructor(func: () => void, a: number, b: string) {
88  }
89}