Open gotrevor opened 7 years ago
I get "Signature mismatch: Invalid number of arguments, expected 1..2" warnings in IDEA using DirtyChai function form assertions such as .null()
and .false()
.
@gotrevor Are these the warnings you're referring to?
@ianbrandt I've not been using WebStorm lately, and don't recall the details.
@joshperry, I took a quick stab at this, but ran into conflicts trying to override the terminating assertion properties in the base Chai.Assertion type declaration. See the TODOs in this diff for the specific errors: https://github.com/prodatakey/dirty-chai/compare/master...ianbrandt:issue-21.
The only workaround I've thought of so far would be to offer a complete replacement for the base Chai type declaration file. It would conflict with the @types/chai
package, and then there's all the code duplication. Any other ideas would be most welcomed.
Without typings dirty-chai
is has limited use in TypeScript based projects. This leads to issues with tslint which are not easy to resolve without disabling the no-unused-expression
rule altogether.
I see the technical issue of the conflicting definitions from @types/chai
which I have no idea how to resolve...
Subscribing to the issue with a hope of seeing a solution in the future.
To get around this issue, I installed the latest version of @types/chai
and then I created these type definitions in a file called chai.d.ts
in my project's rootDir
. Note: This includes the typings for both dirty-chai and sinon-chai.
I see the correct typings in my editor, for all of my files that use dirty-chai, and I can build my application without compiler errors. The important ~line~ hack for dirty-chai is line 23 ((message?: string): Assertion;
).
Let me know if that works for you as well.
Hey guys,
Unfortunately my TS experience is quite limited. I plan to leave this open to hopefully attract a good solution. If you guys come up with something that we can do in this plugin to facilitate, I'm happy to merge it.
Any chance you could add a
dirty-chai
section here: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/chai ?I'm getting warnings from WebStorm about dirtyChai usage, and expect that this would resolve them.