• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 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
16declare function AssertType(value: any, type: string): void;
17
18class Base {
19    public _array : number[];
20    public _stringArray : string[];
21
22    public test() : string {
23        return "test";
24    }
25}
26
27class Student extends Base {
28    public _array : number[];
29    constructor() {
30        super();
31        this._array[0] = 0;
32        this._stringArray[0] = "hello";
33
34        AssertType(this._array, "number[]");
35        AssertType(this._array[0], "number");
36        AssertType(this._stringArray, "string[]");
37        AssertType(this._stringArray[0], "string");
38        AssertType(this.test(), "string");
39    }
40}
41