shouldjs/should.js

Typings for custom assertions

Offen

#174 geöffnet am 02.05.2018

 (2 Kommentare) (0 Reaktionen) (1 zugewiesene Person)JavaScript (131 Forks)batch import
enhancementhelp wanted

Repository-Metriken

Stars
 (1.906 Sterne)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

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;

Contributor Guide