Definitelytyped: @types/[email protected] dep resolves to [email protected]

Created on 14 May 2020  路  7Comments  路  Source: DefinitelyTyped/DefinitelyTyped

...and breaks typescript in the process since versions 24 and 26 typescript versions are not compatible

If you know how to fix the issue, make a pull request instead.

  • [x] I tried using the @types/[email protected] package and had problems.
  • [ ] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
  • [ ] I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
  • [x] [Mention](https://github.com/blog/821-mention-somebody-they-re-notified) the authors (see Definitions by: in index.d.ts) so they can respond.

    • Authors: @G-Rath @lohfu @berickson1 @regevbr (the list of authors is too long...)

the error:

TypeScript error in <my-app>/node_modules/jest-diff/build/diffLines.d.ts(8,13):
'=' expected.  TS1005

     6 |  */
     7 | import { Diff } from './cleanupSemantic';
  >  8 | import type { DiffOptions } from './types';
       |             ^
     9 | export declare const diffLinesUnified: (aLines: string[], bLines: string[], options?: DiffOptions | undefined) => string;
    10 | export declare const diffLinesUnified2: (aLinesDisplay: string[], bLinesDisplay: string[], aLinesCompare: string[], bLinesCompare: string[], options?: DiffOptions | undefined) =>
 string;
    11 | export declare const diffLinesRaw: (aLines: string[], bLines: string[]) => Diff[];

npm ls jest-diff:

+-- @types/[email protected]
| `-- @types/[email protected]
|   `-- [email protected]

also reported in https://github.com/facebook/jest/issues/9986 (but they sent it here)

Most helpful comment

step 1: npm ls jest-diff
+-- @types/[email protected]
| -- @types/[email protected] |-- [email protected]
step2: npm install [email protected]

All 7 comments

@types/[email protected] is deprecated because jest-diff provides its own types, which is also why it pulls in the latest of jest-diff.

The version before that is 20.x.x.

Note that the major version doesn't necessarily correlate 1:1 with the version of jest-diff that the types were added.

I know, but I'm not the one importing @types/[email protected] (or @types/[email protected]). I can't fix all my dependencies (at least I prefer not to).
as you can see above @types/[email protected] eventually triggers a dependency on [email protected] this is a bug in the older version (or in definitelyTyped resolution magic) if there is a way to apply a patch it will be the preferable and correct thing IMO, otherwise, I will find a workaround.

Sorry I missed that for some reason - it's definitely not ideal; I'll look into that a bit.

However, I'm curious to whats requiring @types/jest?

cross mentioning https://github.com/microsoft/create-react-app-uifabric/issues/14 :)

step 1: npm ls jest-diff
+-- @types/[email protected]
| -- @types/[email protected] |-- [email protected]
step2: npm install [email protected]

Can this be fixed quickly? This is a pretty big issue. CRA applications are not compiling and I believe installing [email protected] is the wrong solution. I shouldn't be managing the dependencies of a dependency. And it obviously is a faulty design to import jest-diff@26 for the types of jest-diff@24.

image

Ditto @rt-synchrogrid given this issue breaks a simple fluent ui react starter app. Happy to test out the dev branch if there is a suggested fix/ or updated TypeScript.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jrmcdona picture jrmcdona  路  3Comments

Loghorn picture Loghorn  路  3Comments

lilling picture lilling  路  3Comments

Zzzen picture Zzzen  路  3Comments

JWT
svipas picture svipas  路  3Comments