haim-io / cypress-image-diff

Visual regression test with cypress
MIT License
251 stars 62 forks source link

Types missing for `cypress-image-diff-js/dist/command` #131

Closed karlhorky closed 9 months ago

karlhorky commented 1 year ago

When creating #130 I found that the types are missing for this cypress-image-diff-js/dist/command path that should be imported:

Could not find a declaration file for module 'cypress-image-diff-js/dist/command'. '/Users/k/p/courses/packages/learn.upleveled.io-website/node_modules/cypress-image-diff-js/dist/command.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/cypress-image-diff-js` if it exists or add a new declaration (.d.ts) file containing `declare module 'cypress-image-diff-js/dist/command';`ts(7016)
Screenshot 2022-12-10 at 00 32 47

Maybe these types could also be published so that #130 could also be merged?

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 30 days with no activity.

karlhorky commented 1 year ago

not stale

github-actions[bot] commented 11 months ago

This issue is stale because it has been open for 30 days with no activity.

karlhorky commented 11 months ago

not stale

kapekost commented 11 months ago

not stale

github-actions[bot] commented 10 months ago

This issue is stale because it has been open for 30 days with no activity.

karlhorky commented 10 months ago

Not stale

jpalvarez commented 10 months ago

I was able to solve this error while we wait for the release of version 2.0 in the following way:

First I created the following file cypress/support/commands-patch.js (note that the extension is .js and not .ts)

import compareSnapshotCommand from 'cypress-image-diff-js/dist/command';

export default compareSnapshotCommand;

Second I added the following in the cypress/support/commands.ts file

import compareSnapshotCommand from './commands-patch';

compareSnapshotCommand();

Finally, it is necessary to add this option to the tsconfig.ts file for this to work

{
  "compilerOptions": {
    ...
    "allowJs": true,
  }
}
tamasmagyar commented 9 months ago

can you try the following Typescript guide?

kien-ht commented 9 months ago

This issue should be fixed after this pull request #195. Please upgrade to the latest version and see if the error still persists. I have created some integration examples here in case you want a reference.