• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2* Copyright (c) Microsoft Corporation. All rights reserved.
3* Copyright (c) 2023 Huawei Device Co., Ltd.
4* Licensed under the Apache License, Version 2.0 (the "License");
5* you may not use this file except in compliance with the License.
6* You may obtain a copy of the License at
7*
8*     http://www.apache.org/licenses/LICENSE-2.0
9*
10* Unless required by applicable law or agreed to in writing, software
11* distributed under the License is distributed on an "AS IS" BASIS,
12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13* See the License for the specific language governing permissions and
14* limitations under the License.
15*
16* This file has been modified by Huawei to verify type inference by adding verification statements.
17*/
18
19// === tests/cases/conformance/internalModules/moduleBody/moduleWithStatementsOfEveryKind.ts ===
20declare function AssertType(value:any, type:string):void;
21module A {
22    class A { s: string }
23    class AA<T> { s: T }
24    interface I { id: number }
25
26    class B extends AA<string> implements I { id: number }
27    class BB<T> extends A {
28        id: number;
29    }
30
31    module Module {
32        class A { s: string }
33    }
34    enum Color { Blue, Red }
35    let x = 12;
36    function F(s: string): number {
37AssertType(2, "int");
38        return 2;
39    }
40    let array: I[] = null;
41    let fn = (s: string) => {
42AssertType('hello ' + s, "string");
43AssertType('hello ', "string");
44AssertType(s, "string");
45        return 'hello ' + s;
46    }
47    let ol = { s: 'hello', id: 2, isvalid: true };
48
49    declare class DC {
50        static x: number;
51    }
52}
53
54module Y {
55    export class A { s: string }
56    export class AA<T> { s: T }
57    export interface I { id: number }
58
59    export class B extends AA<string> implements I { id: number }
60    export class BB<T> extends A {
61        id: number;
62    }
63
64    export module Module {
65        class A { s: string }
66    }
67    export enum Color { Blue, Red }
68    export let x = 12;
69    export function F(s: string): number {
70AssertType(2, "int");
71        return 2;
72    }
73    export let array: I[] = null;
74    export let fn = (s: string) => {
75AssertType('hello ' + s, "string");
76AssertType('hello ', "string");
77AssertType(s, "string");
78        return 'hello ' + s;
79    }
80    export let ol = { s: 'hello', id: 2, isvalid: true };
81
82    export declare class DC {
83        static x: number;
84    }
85}
86
87
88