codeceptjs / codeceptjs/CodeceptJS

[feature-request] export cucumber-related types

未关闭
#2,926 3 条评论 3 个 reaction 已指派 1 人 已被 @zaxovaiko 认领 在 GitHub 查看
enhancement good first issue typescript
主要语言
JavaScript
星标
4.2k
派生
757
平均合并
2 天 9 小时
30 天内合并 PR
16

描述

#### What are you trying to achieve?

export `DataTable` and other cucumber-related types such that we can use it in step definitions

#### What do you get instead?

I need to manually define it on our own
```ts
interface OwnTableDefinition {
/**
* obtain an object that allows you to get a simple version of the table parsed by column or row
*/
parse(): {
/**
* returns the table as a 2-D array
*/
raw(): string[][],
/**
* returns the table as a 2-D array, without the first row
*/
rows(): string[][],
/**
* returns an array of objects where each row is converted to an object (column header is the key)
*/
hashes(): { [colName: string]: string }[],
};
rows: { [id: number]: { cells: { value: string }[] } };
}
```
```ts
Given('I have products in my cart', (table: OwnTableDefinition) => {
table.parse()
})
```

### Details

* CodeceptJS version: 3.0.7
* NodeJS Version: 12.20.1
* Operating System: MacOS

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。