Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DefinitelyTyped? #21

Open
gotrevor opened this issue Nov 17, 2016 · 6 comments
Open

DefinitelyTyped? #21

gotrevor opened this issue Nov 17, 2016 · 6 comments

Comments

@gotrevor
Copy link

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.

@ianbrandt
Copy link

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?

@gotrevor
Copy link
Author

@ianbrandt I've not been using WebStorm lately, and don't recall the details.

@ianbrandt
Copy link

@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: 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.

@another-guy
Copy link

another-guy commented Sep 30, 2017

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.

@nwronski
Copy link

nwronski commented Dec 4, 2017

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.

@joshperry
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants