codeceptjs / codeceptjs/CodeceptJS

[Types] Unable to extend ILocator, and addFilter is missing from Locator

Đang mở
#2,565 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
4.2k
Fork
757
Merge trung bình
2 ngày 9 giờ
Pull request đã merge (30 ngày)
16

Mô tả

#### What are you trying to achieve?

I would like to extend the `ILocator` type in order to add a custom Locator to it (e.g. {da: string}) for selecting elements with a custom `data-automation` attribute.

I would also like to call `locator.addFillter()` without getting a TS error.

#### What do you get instead?

##### ILocator

I am unable to extend ILocator type as it isn't exported on the types:

![image](https://user-images.githubusercontent.com/7611706/91538748-323f9e00-e910-11ea-8cf6-3f5798280d8f.png)

##### Locator

I have to extend `Locator` to declare `addFilter`, as this property is missing from the generated types.

``` ts

interface Locator {
addFilter: (
callback: (
providedLocator: Record,
locatorObj: { type: string; value: string },
) => void,
) => void;
}

```

otherwise, I'll get this:
![image](https://user-images.githubusercontent.com/7611706/91539368-1b4d7b80-e911-11ea-8fac-5110d3f4b2c3.png)

### Details

* CodeceptJS version: 2.6.8
* NodeJS Version: 12
* Operating System: OSX
* playwright: 1.3.0

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.