You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
first of all: Thanks a lot for all the work you have put into earl. We are currently evaluating if we will switch from chai to it because the lack of type-safety is really an issue.
We have tons of chai assertions using chai-subset that are written like this:
Okay so I had a go at fixing this and pretty quickly stumbled upon that expect.subset, like all the other matchers, returns as type never. This is an issue since never can be assigned to any type.
So in my opinion either we change the types of all matchers (or add an optional generic of type T to Matcher) so that we can capture what was given to the matcher and reuse that inside the validators.
Based on toInclude my fix would then look like this:
Or maybe it's a better approach to add a new Validator altogether for validating whether objects are (partially) included in a given array. Not sure about introducing bloat to the API though.
Hi,
first of all: Thanks a lot for all the work you have put into earl. We are currently evaluating if we will switch from chai to it because the lack of type-safety is really an issue.
We have tons of chai assertions using chai-subset that are written like this:
The same assertion can be written with earl using:
However it is not type safe as the following would also compile:
I would expect subset() to only accept Partials or (or deep Partials) of the type of items that are passed to expect().
The text was updated successfully, but these errors were encountered: