代码如下:
// file1.ts
export * from "aaa";
export * from "bbb";
export * from "ccc";
export const a = 1;
export const b = 2;
// file2.ts
import * as balala from "./file1.ts";
Object.getOwnPropertyNames(balala)
.forEach((key) => {
const module = balala[key];
});
在使用balala[key]获取模块时爆红了,提示如下;搜索半天无果,请教下这种情况该怎么解决呢?
Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'typeof import("/Users/xxxx/xxx/file1.ts")