jaredpalmer / cypress-image-snapshot

Catch visual regressions in Cypress
MIT License
887 stars 160 forks source link

addMatchImageSnapshotCommand: Argument of type '{ customDiffConfig: { threshold: number; }; }' is not assignable to parameter of type 'string'.ts #210

Open edouard-lopez opened 3 years ago

edouard-lopez commented 3 years ago

package.json

{
    "cypress": "^8.0.0",
    "cypress-image-snapshot": "^4.0.1",
    "typescript": "^4.1.5",
}

cypress/support/commands/snapshot.ts

import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command';

addMatchImageSnapshotCommand({
  customDiffConfig: { threshold: 0.15 }, // threshold for each pixel
});

Documentation

The readme show it's a possible usage: https://github.com/jaredpalmer/cypress-image-snapshot/blob/0510252bc5f192c410bcca45b511f07737bce4a2/README.md#L68

Error

VSCode show me this error message, despite the documentation

Argument of type '{ customDiffConfig: { threshold: number; }; }' is not assignable to parameter of type 'string'.ts(2345)