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

Dependency on should(js) causes typescript compilation problems when other dependencies use chai #476

Open
lev-kuznetsov opened this issue Aug 22, 2021 · 1 comment
Assignees
Labels
dependencies Pull requests that update a dependency file

Comments

@lev-kuznetsov
Copy link

Detailed Description

Both shouldjs and chai add a .should to Object and a project where dependencies use each produces compilation problem verbatim as follows:

> tsc -d

node_modules/should/should.d.ts:237:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'should' must be of type 'Assertion', but here has type 'Assertion'.

237     should: should.Assertion;
        ~~~~~~

  node_modules/@types/chai/index.d.ts:1975:5
    1975     should: Chai.Assertion;
             ~~~~~~
    'should' was also declared here.


Found 1 error.

Shouldjs has not been updated in 3 years and is abandoned at this point. I can rewrite current should assertions to use chai (will look basically the same as current just change the import statement) or assert - which is used in some of the tests; if this PR would be welcome and considered for a merge. Please let me know.

Other stuff

Everything is up to date.

@MikeRalphson
Copy link
Contributor

This issue seems to stem from a limitation of the Typescript types for either should.js or chai (or both). oas-kit only uses should/as-function which does not mutate the Object prototype.

I would be happy to migrate to chai or another maintained assertion library if:

  • size of transitive dependencies is roughly similar
  • all of oas-validator could be migrated, not just the tests.

A PR would be welcome, but please hold fire for now, as I have a few WIP branches to merge. I will update this issue when that block is removed.

@MikeRalphson MikeRalphson added the dependencies Pull requests that update a dependency file label Aug 25, 2021
@MikeRalphson MikeRalphson self-assigned this Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

2 participants