如何在打字稿中使用带有异步等待的动态导入?

时间:2020-07-26 17:25:37

标签: typescript import async-await

在此打字稿代码中

        ds_achievement.GetConditionsList().map(async (condition:string):Promise<void> => {
            const value = ds_achievement.GetAchievementValueByCondition(condition);
            const module:unknown = await import(`../../achievements/conditions/${condition}/condition`);
            const m = new module();
            const data = m.Check(this, ds_boss_acc, ds_item_acc, value);
            ds_boss_acc = data.ds_boss_acc;
            ds_item_acc = data.ds_item_acc;
            passed_achievement = passed_achievement && data.passed;
        });

我明白了

Unsafe assignment of an any value.eslint@typescript-eslint/no-unsafe-assignment

我在哪里import。我该如何解决?

谢谢

0 个答案:

没有答案