• 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
18type A1 = string;
19type B = number;
20declare namespace NS1 {
21  export {NS2, A1}
22}
23declare namespace NS2 {
24  export {NS1, B}
25}
26export {}
27
28declare const try1: NS1.A1;
29declare const try2: NS2.B;
30declare const try3: NS1.NS2.B;
31declare const try4: NS2.NS1.A1;
32declare const try5: NS1.NS2.NS1.A1;
33declare const try6: NS2.NS1.NS2.B;
34
35let a1: NS1.A1 = "a";
36let a2: NS2.B = 1;
37let a3: NS1.NS2.B = 2;
38let a4: NS2.NS1.A1 = "b";
39let a5: NS1.NS2.NS1.A1 = "c";
40let a6: NS2.NS1.NS2.B = 3;
41assert(a1 === "a");
42assert(a2 === 1);
43assert(a3 === 2);
44assert(a4 === "b");
45assert(a5 === "c");
46assert(a6 === 3);
47
48
49declare namespace ns1 {
50  function foo1(): void;
51  let val: number;
52}
53declare module ns2 {
54  function foo1(): void;
55  let val: number;
56}
57declare module ns3 {
58  export let val: alias;
59  type alias = number;
60  export {};
61}
62