• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024-2025 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 { foo };
17
18function bar(): int {
19    return 1;
20}
21
22/*-----------------*/
23function foo2(): void {}
24class TestClass {}
25
26export {foo2}
27export type {TestClass as foo2}
28
29/*-----------------*/
30export default function foo3(): void {}
31
32export {
33  foo3 as bar
34}
35
36/*-----------------*/
37export class A {}
38
39export type {A as AA};
40
41/*-----------------*/
42interface I {}
43
44export type {I}
45export type MyI = I
46export type {MyI}
47/*-----------------*/
48
49function f(){
50    return 1;
51}
52
53export type {f}
54/*-----------------*/
55
56export default function TestFunc(): void {}
57export default function TestFuncToo(): void {}
58
59/*-----------------*/
60/* @@? 16:10 Error SyntaxError: Cannot find name 'foo' to export. */
61/* @@? 27:14 Error SyntaxError: Cannot export two different names with the same export alias name 'foo2'. */
62/* @@? 56:16 Error TypeError: Only one default export is allowed in a module */
63/* @@? 57:16 Error TypeError: Only one default export is allowed in a module */
64