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

Use chaining no longer works #1650

Open
AGrzes opened this issue Oct 18, 2024 · 4 comments
Open

Use chaining no longer works #1650

AGrzes opened this issue Oct 18, 2024 · 4 comments

Comments

@AGrzes
Copy link

AGrzes commented Oct 18, 2024

Previously I often used code like

import chai from 'chai'

chai.use(pluginA).use(pluginB)

Now it no longer works - I have to ho with

chai.use(pluginA)
chai.use(pluginB)

The type definitions suggest that the old way should work - that use returns Chai.ChaiStatic but it is not the case.

It may be related to #1638 - fix proposed there would also fix this issue.

@AGrzes
Copy link
Author

AGrzes commented Oct 18, 2024

#1639 would fix this

@43081j
Copy link
Contributor

43081j commented Oct 19, 2024

I think the preferred usage these days is to not chain it and use the exported use function rather than the 'chai static' it returns

but you are right, #1639 would allow you to chain again and should be merged

@AGrzes
Copy link
Author

AGrzes commented Oct 19, 2024

I understand - but then either #1639 should be merged or type definitions updated.
Removing this line
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/367fcd5cc72baeab1c7fa927f774a36ec7685c69/types/chai/index.d.ts#L83
Would reflect current state of main code.

@43081j
Copy link
Contributor

43081j commented Oct 19, 2024

The PR should be merged 👍

If I get chance I can try catch it up and get it done

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

No branches or pull requests

2 participants