shouldjs/should.js

Typings for custom assertions

Open

#174 建立於 2018年5月2日

在 GitHub 查看
 (2 留言) (0 反應) (1 負責人)JavaScript (131 fork)batch import
enhancementhelp wanted

倉庫指標

Star
 (1,906 star)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

Hi.

Node.js version?

8.11.1

Should.js version?

13.2.1

How to reproduce it?

When using shouldjs with Typescript and extending the should Assertions with a custom function: Lets say:

Assertion.add('asset', function() {
     this.params = { operator: 'to be asset' }

     this.obj.should.have.property('id').which.is.a.Number()
     this.obj.should.have.property('path')
})

Compiling Typescript will throw an error when using the should(obj).asset() function because it doesn't exist on the type Assertion. Simplest solution would by adding the following to the Assertion interface to allow dynamic properties:

[key: string]: any;

貢獻者指南