gpt4 book ai didi

javascript - 是否有通配符导出为的语法?

转载 作者:行者123 更新时间:2023-11-30 09:21:13 25 4
gpt4 key购买 nike

<分区>

导入语法:

import * as foo from 'bar';

我同样尝试过:

export * as foo from 'bar';

但这引发了错误:

ERROR in src/app/@theme/components/aComp/aComp.loader.ts(1,10): error TS1005: 'from' expected.
src/app/@theme/components/aComp/aComp.loader.ts(1,13): error TS1005: ';' expected.
src/app/@theme/components/aComp/aComp.loader.ts(1,17): error TS1005: ';' expected.
src/app/@theme/components/aComp/aComp.loader.ts(1,22): error TS1005: ';' expected.

还有导出语法:

export { default as foo } from 'bar';

有没有办法为 * 而不是 default 做到这一点?


(仅供引用,我正在尝试从语句中删除 require):

export const foo = require('bar');

ng serve 运行包括上面的 .ts 时抛出下面的错误:

ERROR in src/app/@theme/components/aComp/aComp.loader.ts(6,20): error TS2304: Cannot find name 'require'.

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com