-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
Convert to TypeScript and add public types #75
Comments
So admittedly I am a TS amateur. I was just playing around with things and I did get it to config a bit easier if I added index.d.ts directly to the node_modules/cypress-image-snapshot/ with import 'cypress';
declare global {
namespace Cypress {
interface Chainable {
matchImageSnapshot: (options?: any) => void;
}
}
} Obviously hacking a node_modules folder is a no no but I thought that might be a way to go though im not sure how much different it is from having a custom types folder somewhere else. I have seen a few other plugins use this sort of pattern and thought I would give it a shot. |
Yep that makes sense! So if we add an I think what would be even better is if we rewrite to use TypeScript and then generate But creating types manually is definitely useful if we want to start there. |
Im pretty new to typescript but would like to have a go at this issue if it is ok? |
@makeupsomething for sure give it a shot! I'm happy to review any PRs. |
import "cypress";
import "jest.d.ts";
import * as JestImageSnapshot from "jest-image-snapshot";
declare global {
namespace Cypress {
interface Chainable {
matchImageSnapshot: (
options?:
| string
| (Partial<
JestImageSnapshot.MatchImageSnapshotOptions &
Loggable &
Timeoutable &
ScreenshotOptions
>),
) => void;
}
}
} Just based on what I understood from the readme, just a good stop gap for now. |
Adding |
Any solution? How to use this plugin with typescript? |
I shifted to Percy. They have a free version as well and much smoother. Had no luck here. |
I went ahead and added typings for folks to use: DefinitelyTyped/DefinitelyTyped#41222 Now, all you need to do is |
@Keysox Think the options are missing |
@Svish -- options have been added if you upgrade to |
There have been a few issues related to TypeScript types (#13, #72), updating the source code to TypeScript would make future changes easier and give consumers better type support.
The text was updated successfully, but these errors were encountered: