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

Cannot find name 'SnapshotStateOptions' #15

Closed
Maxim-Mazurok opened this issue Aug 29, 2022 · 3 comments
Closed

Cannot find name 'SnapshotStateOptions' #15

Maxim-Mazurok opened this issue Aug 29, 2022 · 3 comments

Comments

@Maxim-Mazurok
Copy link
Contributor

Getting this error when running tsc, with "skipLibCheck": false

node_modules/mocha-chai-jest-snapshot/dist/utils/jest-test-result-helper.d.ts:14:58 - error TS2304: Cannot find name 'SnapshotStateOptions'.

14 export declare const makeEmptySnapshotSummary: (options: SnapshotStateOptions) => SnapshotSummary;
                                                            ~~~~~~~~~~~~~~~~~~~~


Found 1 error in node_modules/mocha-chai-jest-snapshot/dist/utils/jest-test-result-helper.d.ts:14
@Maxim-Mazurok
Copy link
Contributor Author

Maxim-Mazurok commented Aug 29, 2022

To fix this, I had to add these two patches:

mocha-chai-jest-snapshot+1.1.4.patch:

diff --git a/node_modules/mocha-chai-jest-snapshot/dist/utils/jest-test-result-helper.d.ts b/node_modules/mocha-chai-jest-snapshot/dist/utils/jest-test-result-helper.d.ts
index 7ce132e..2453da2 100644
--- a/node_modules/mocha-chai-jest-snapshot/dist/utils/jest-test-result-helper.d.ts
+++ b/node_modules/mocha-chai-jest-snapshot/dist/utils/jest-test-result-helper.d.ts
@@ -5,7 +5,7 @@
  * LICENSE file in the root directory of this source tree.
  */
 import { SnapshotSummary, TestResult } from "@jest/test-result";
-import { SnapshotState } from "jest-snapshot";
+import { SnapshotState, SnapshotStateOptions } from "jest-snapshot";
 declare type SnapshotResult = TestResult["snapshot"];
 export { SnapshotSummary };
 export declare const makeEmptySnapshotSummary: (options: SnapshotStateOptions) => SnapshotSummary;

and
mocha-chai-jest-snapshot++jest-snapshot+28.1.3.patch:

diff --git a/node_modules/mocha-chai-jest-snapshot/node_modules/jest-snapshot/build/index.d.ts b/node_modules/mocha-chai-jest-snapshot/node_modules/jest-snapshot/build/index.d.ts
index 3f20807..b47c90a 100644
--- a/node_modules/mocha-chai-jest-snapshot/node_modules/jest-snapshot/build/index.d.ts
+++ b/node_modules/mocha-chai-jest-snapshot/node_modules/jest-snapshot/build/index.d.ts
@@ -148,7 +148,7 @@ export declare class SnapshotState {
   fail(testName: string, _received: unknown, key?: string): string;
 }
 
-declare type SnapshotStateOptions = {
+export declare type SnapshotStateOptions = {
   updateSnapshot: Config.SnapshotUpdateState;
   prettierPath: string;
   expand?: boolean;

using https://www.npmjs.com/package/patch-package

@rostalevicek
Copy link

Is it possible to merge this patch?

@Maxim-Mazurok
Copy link
Contributor Author

Is it possible to merge this patch?

I've created a PR with alternative fix: #19

mochiya98 added a commit that referenced this issue Aug 23, 2024
Fix #15 - Cannot find name 'SnapshotStateOptions'
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