vue-testing-library icon indicating copy to clipboard operation
vue-testing-library copied to clipboard

TypeScript v8.1.0: Cannot find module 'type-fest' or its corresponding type declarations - RemoveIndexSignature

Open zymotik opened this issue 1 year ago • 4 comments

TypeScript build of version 8.1.0 fails with:

node_modules/@testing-library/vue/types/index.d.ts:10:36 - error TS2307: Cannot find module 'type-fest' or its corresponding type declarations.

import {RemoveIndexSignature} from 'type-fest

This is due to RemoveIndexSignature being renamed to OmitIndexSignature in type-fest v3 and then being removed in a later version.

I would suggest specifying type-fest version 2.19 as a potential fix in the package.json. Version 3 and above appear to cause other issues.

Testing-library commit that causes the issue: https://github.com/testing-library/vue-testing-library/commit/d46ed8f757e77fe85b369847c21d394bb9706066#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R71

Deprecation notice of RemoveIndexSignature from type-fest: https://github.com/sindresorhus/type-fest/issues/387

zymotik avatar May 20 '24 13:05 zymotik

Workaround, install previous version:

npm install @testing-library/[email protected] -D

zymotik avatar May 20 '24 13:05 zymotik

Or in your package.json, provide the hint:

  "overrides": {
    "type-fest": ">=2.10 <4.0.0"
  },

zymotik avatar Sep 09 '24 16:09 zymotik

👋

PR ready: https://github.com/testing-library/vue-testing-library/pull/320

zymotik avatar Oct 02 '24 11:10 zymotik

Or in your package.json, provide the hint:

  "overrides": {
    "type-fest": ">=2.10 <4.0.0"
  },

This will break other lib which deps on type-fest v4

In pnpm, we should use

  "pnpm": {
    "packageExtensions": {
      "@testing-library/vue": {
        "dependencies": {
          "type-fest": "~2.19"
        }
      }
    }
  },

xiaoxiangmoe avatar Dec 21 '24 16:12 xiaoxiangmoe