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

add typescript definitions to chai #822

Closed
wants to merge 3 commits into from
Closed

Conversation

goenning
Copy link

@goenning goenning commented Oct 3, 2016

I've been using chai with all my TypeScript projects and having the Chai core team maintaining the definitions would be perffect.

@keithamus are you still interested on it?

This PR includes both the definitions and test cases. It's basically a copy from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/types-2.0/chai

This PR should close /issues/650 and typed-typings/npm-chai/issues/14

@goenning
Copy link
Author

goenning commented Oct 3, 2016

@unional Oh, I completely forgot about https://github.com/types/npm-chai. Do you know if it's more up-to-date than DefinitelyTyped? I've been using DT for a long time, nothing to complain about it.

@unional
Copy link
Contributor

unional commented Oct 3, 2016

No problem. npm-chai was also started from DT. If you found no problem with it, it is ok to use that version.

@keithamus
Copy link
Member

keithamus commented Oct 4, 2016

@goenning thanks a bunch for this PR! Still interested in taking this in, but right now we're focussing on a 4.0 release. I'll leave this PR open, but we won't merge until 4.0 has been released.

@JoshuaKGoldberg
Copy link

@goenning you'll want to update these with the latest definitions. https://github.com/DefinitelyTyped/DefinitelyTyped/tree/40354debb1db20dd93f52ffe6394bb5a310109a1/types/chai

@demurgos
Copy link

Do you need some help with this? I'm a types contributor and would gladly help with providing type definitions for chai. Having the types in the library repo facilitates maintenance and usage.
It not only helps Typescript users, but also JS users because editors can grab the type definitions instead of guessing them by analyzing the code.

@keithamus
Copy link
Member

@demurgos that would be excellent! Now we're past the 4.0 release we can start focussing on PRs like this.

Getting the types here up to date with the current API would be a first priority; as well as that if we could have someone from the TS community confirm that how we would distribute these is the correct way to go, then I'm very happy to get this in for a new minor release.

@jamesandersonwalsh
Copy link

Hey! Wondering what's blocking review/approval on this? I think it would be great for chai to provide its own typings. Is it just updating the type definitions to match the v4+ api?

@keithamus
Copy link
Member

Yes I'd like to make sure before we ago ahead with this, that we get it up to date with the v4 API, so that it can be used right away.

@lucasfcosta
Copy link
Member

Hey folks, how are we on this?

I'm thinking about doing my best to close/merge open PRs so that we can move forward in a better way.

Let me know if y'all need any help with this.

@demurgos
Copy link

Sorry, I haven't had much time to look into this but I may look at it in the next days.

@goenning
Copy link
Author

I have initially created this PR, but haven’t got time to push it forward. Sorry about that.

@JoshuaKGoldberg
Copy link

I'll go ahead and make a new one now...

@unional
Copy link
Contributor

unional commented Nov 23, 2017

@JoshuaKGoldberg if you are making a new one, would it make sense to get rid of the lodashStatic namespaces (if it is not too much work)? I tried to do that on npm-chai but didn't find time to finish and keep it up to date.

@JoshuaKGoldberg
Copy link

@unional I'm copying from DefinitelyTyped and not seeing them there or on types/npm-chai. Am I missing something?

@unional
Copy link
Contributor

unional commented Nov 23, 2017

Nevermind, I think it will be way too much work to change the typings in DT

I mean the interfaces: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/index.d.ts#L256
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/index.d.ts#L499

Arrh.... I was mixing up lodash and chai.... sorry, it is late at night.

@keithamus
Copy link
Member

Thanks very much for all of your work here @goenning! It looks like @JoshuaKGoldberg has picked this up in #1092 and so I'll close this one and we can focus on #1092.

Hopefully the next minor release of chai will come with typescript definitions 🎉

@keithamus keithamus closed this Nov 23, 2017
demurgos pushed a commit to demurgos/chai that referenced this pull request Jan 7, 2018
This commit adds type definitions for Chai. These type definitions are
based on the types from DefinitelyTyped. They enable Typescript users
to use the library directly and serve as documentation.

The main changes from the DT version are:
- Use external module style
- Use `AssertionError` types from `assertion-error`
- Fix global modification of objects with `should`

The types can be improved in further PRs.

This commit also adds tests for the type definitions. It tries to
compile (in noEmit mode) the files in `test/typings` using the type
definitions. This adds `typescript` as a new dev dependency.

For maintenance and semver, the types should be treated as
documentation. They should be kept up-to-date with the code, especially
when breaking changes occur (wrong documentation is worse than
incomplete documentation), see discussion in chaijs#1092.
[Help for type definitions][ts-declarations]

- Closes chaijs#650 (original issue)
- See chaijs#822 (previous PR with merge conflicts)
- Closes chaijs#1092 (superseded by this PR)

[ts-declarations]: https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html
keithamus pushed a commit to demurgos/chai that referenced this pull request Mar 22, 2018
This commit adds type definitions for Chai. These type definitions are
based on the types from DefinitelyTyped. They enable Typescript users
to use the library directly and serve as documentation.

The main changes from the DT version are:
- Use external module style
- Use `AssertionError` types from `assertion-error`
- Fix global modification of objects with `should`

The types can be improved in further PRs.

This commit also adds tests for the type definitions. It tries to
compile (in noEmit mode) the files in `test/typings` using the type
definitions. This adds `typescript` as a new dev dependency.

For maintenance and semver, the types should be treated as
documentation. They should be kept up-to-date with the code, especially
when breaking changes occur (wrong documentation is worse than
incomplete documentation), see discussion in chaijs#1092.
[Help for type definitions][ts-declarations]

- Closes chaijs#650 (original issue)
- See chaijs#822 (previous PR with merge conflicts)
- Closes chaijs#1092 (superseded by this PR)

[ts-declarations]: https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dup or difference? deep.equal() and deep.equals()
7 participants