• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 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
16import assert from 'assert'
17// Only use for testing importEqualsDeclaration in toplevel
18import temp1 = require('fs');
19export import temp2 = require('fs');
20module X {
21  export module Y {
22    export interface Z {
23      a:number;
24    }
25  }
26  export interface Y {
27    b:string;
28  }
29}
30let a:X.Y.Z = {a:1}
31assert(a.a === 1);
32let b:X.Y = {b:"1"}
33assert(b.b === "1");
34
35module A {
36  export module B {
37    export class C {
38      c: boolean = true;
39    }
40  }
41}
42
43var c: A.B.C = new A.B.C();
44assert(c.c === true)
45
46module M {
47  export namespace N {
48    export module M2 {
49      export interface I {
50        d: number;
51      }
52    }
53  }
54}
55let d: M.N.M2.I = {d:2}
56assert(d.d === 2)
57
58type A = number;
59declare const Q1:number;
60declare namespace Q2 {
61  export {A}
62}
63let e:Q2.A = 3;
64assert(e ===3);
65
66namespace ns1 {
67  namespace ns2 {
68      export var temp3 : string = "test-importEqualsDeclaration";
69  }
70  import temp4 = ns2.temp3;
71  export import temp5 = ns2.temp3;
72  assert(temp4 === "test-importEqualsDeclaration")
73  assert(temp5 === "test-importEqualsDeclaration")
74}
75
76namespace ns1 {
77  assert(temp5 === "test-importEqualsDeclaration")
78}
79
80assert(ns1.temp5 === "test-importEqualsDeclaration")
81export {}