首页 > 解决方案 > 如何定义赛普拉斯任务返回类型的类型?

问题描述

我的目标是为我的 cypress 任务定义类型,用 typescript 编写。

当我使用自定义任务时,我目前有这个:

cy.task('customTask').then(v => {
   // v is undefined here - how can I configure types?
});

插件/index.ts

module.exports = (on) => {
  on('task', {
    customTask: () => {
      return 23;
    }
  });
}

标签: typescriptcypress

解决方案


推荐阅读