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

Import issues in latest version (25.2.0) #9703

Closed
HobbyProjects opened this issue Mar 25, 2020 · 25 comments · Fixed by #9705
Closed

Import issues in latest version (25.2.0) #9703

HobbyProjects opened this issue Mar 25, 2020 · 25 comments · Fixed by #9705

Comments

@HobbyProjects
Copy link

HobbyProjects commented Mar 25, 2020

💥 Regression Report

Doing an npm i shows the import errors:

tsc -b .
../node_modules/jest-diff/build/diffLines.d.ts:8:13 - error TS1005: '=' expected.
8 import type { DiffOptions } from './types';
~../node_modules/jest-diff/build/diffLines.d.ts:8:34 - error TS1005: ';' expected.
8 import type { DiffOptions } from './types';
~~~~~~~~~
../node_modules/jest-diff/build/index.d.ts:10:13 - error TS1005: '=' expected.
10 import type { DiffOptions } from './types'; ~
../node_modules/jest-diff/build/index.d.ts:10:34 - error TS1005: ';' expected.
10 import type { DiffOptions } from './types'; ~~~~~~~~~
../node_modules/jest-diff/build/index.d.ts:11:1 - error TS1128: Declaration or statement expected.
11 export type { DiffOptions, DiffOptionsColor } from './types';

Last working version

25.1.0

Stopped working in version:

25.2.0

To Reproduce

just do a npm i

Steps to reproduce the behavior:

just do a npm i

Expected behavior

A clear and concise description of what you expected to happen.

jest -diff installs without any issues whatsoever

Link to repl or repo (highly encouraged)

Please provide either a repl.it demo or a minimal repository on GitHub.

Issues without a reproduction link are likely to stall.

Run npx envinfo --preset jest

Paste the results here:

npx: installed 1 in 3.108s

  System:
    OS: Windows 10 10.0.18363
    CPU: (4) x64 Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz
  Binaries:
    Node: 12.4.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.10.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.13.7 - C:\Program Files\nodejs\npm.CMD
@danidelgadoz
Copy link

Same issue here (v 24.0.18)

@paulconlin
Copy link

paulconlin commented Mar 25, 2020

Looks like maybe this PR did it? #9693

@SimenB any ideas? Not familiar with the import type *. I can only find info about it in the requested features for flow facebook/flow#6726

image

@atmike
Copy link

atmike commented Mar 25, 2020

Same on my side. When can you fix this. I have to make on urgent build for my Customer.
Or is there a workaround?
I'm getting this error with 25.1.0 and 25.2.0

@paulconlin
Copy link

It looks like you need typescript > 3.8.0 as support was just recently added - https://devblogs.microsoft.com/typescript/announcing-typescript-3-8-rc/

Also referenced here - facebook/create-react-app#8714

Installing typescript latest or at least v3.8.2 will fix it.

@atmike
Copy link

atmike commented Mar 25, 2020

@paulconlin
thx for your answer. I updated the my devDependencies => to 3.8.3 but with no effect
"devDependencies": {
"typescript": "3.8.3",
NG Buid still throws me the following errors

`
10 import type { DiffOptions } from './types';
~~~~~~~~~
../node_modules/jest-diff/build/index.d.ts:11:1 - error TS1128: Declaration or statement expected.

11 export type { DiffOptions, DiffOptionsColor } from './types';

../node_modules/jest-diff/build/index.d.ts:11:13 - error TS1005: ';' expected.

11 export type { DiffOptions, DiffOptionsColor } from './types';
            ~
../node_modules/jest-diff/build/index.d.ts:11:52 - error TS1005: ';' expected.

11 export type { DiffOptions, DiffOptionsColor } from './types';
                                                   ~~~~~~~~~
../node_modules/jest-diff/build/printDiffs.d.ts:8:13 - error TS1005: '=' expected.

8 import type { DiffOptions, DiffOptionsNormalized } from './types';
           ~
../node_modules/jest-diff/build/printDiffs.d.ts:8:57 - error TS1005: ';' expected.

8 import type { DiffOptions, DiffOptionsNormalized } from './types';
                                                       ~~~~~~~~~
../node_modules/pretty-format/build/index.d.ts:7:13 - error TS1005: '=' expected.

7 import type * as PrettyFormat from './types';
           ~
../node_modules/pretty-format/build/index.d.ts:7:18 - error TS1005: ';' expected.

7 import type * as PrettyFormat from './types';
                ~~~~~~~~~~~~
../node_modules/pretty-format/build/index.d.ts:7:31 - error TS1005: ';' expected.

7 import type * as PrettyFormat from './types';
                             ~~~~
../node_modules/pretty-format/build/index.d.ts:7:36 - error TS1005: ';' expected.

7 import type * as PrettyFormat from './types';
`

@HobbyProjects
Copy link
Author

Updating to ts 3.8.3 didn't fix it either. The only workaround we found was to pin the jest-diff version to an older one in package-lock.json

@sachinjoseph
Copy link

Can confirm this on multiple Microsoft repos

@atmike
Copy link

atmike commented Mar 25, 2020

@HobbyProjects
how have you done that
I Added
"jest-diff": "24.9.0",
"pretty-format": "24.9.0"
to project.json. But it still get the same errors

@paulconlin
Copy link

paulconlin commented Mar 26, 2020

Make sure you do a full clean. Delete your node_modules and package-lock file, up the version, and then npm install.

@atmike
Copy link

atmike commented Mar 26, 2020

nothing helped. I have removed the package vor now and all test files that I can make a build :(
thx for your help

@gae123
Copy link

gae123 commented Mar 26, 2020

Adding the following to your package.json should get you going for now, but please address this ASAP

"resolutions": {
    "jest-diff": "25.1.0"
}

@riccardogiorato
Copy link

I have the same issues as @HobbyProjects

@SimenB
Copy link
Member

SimenB commented Mar 26, 2020

Sorry about this, working on a fix

@Vizzr
Copy link

Vizzr commented Mar 26, 2020

Adding the following to your package.json should get you going for now, but please address this ASAP

"resolutions": {
    "jest-diff": "25.1.0"
}

I also had to add "pretty-format" : "25.1.0" to it in order to solve the issue for pretty-format
Resulting in:

"resolutions": {
    "jest-diff": "25.1.0",
    "pretty-format" : "25.1.0"
}

Then I had to add the following to my package.json dev dependencies:

    "jest-diff": "^25.1.0",
    "pretty-format": "^25.1.0"

@SimenB
Copy link
Member

SimenB commented Mar 26, 2020

Fix published in 25.2.1, sorry about the inconvenience.

@sachinjoseph
Copy link

I am still running into this on @jest/core 25.2.2

@asciidiego
Copy link

This issue was fixed in 25.2.3

#9714 (comment)

@tunesmith
Copy link

I'm experiencing this problem with typescript 3.9.7 and jest 26.6:

├─┬ @types/[email protected]
│ └── [email protected] 
└─┬ [email protected]
  └─┬ @jest/[email protected]
    └─┬ [email protected]
      ├── [email protected] 
      └─┬ [email protected]
        └── [email protected] 

@heavenkiller2018
Copy link

I'm experiencing this problem with typescript 4.0.5 and jest 26.4.2:

@auleki
Copy link

auleki commented Nov 9, 2020

It looks like you need typescript > 3.8.0 as support was just recently added - https://devblogs.microsoft.com/typescript/announcing-typescript-3-8-rc/

Also referenced here - facebook/create-react-app#8714

Installing typescript latest or at least v3.8.2 will fix it.

Ran into this issue and installing TS v3.8.3 solved it for me

@SimenB
Copy link
Member

SimenB commented Nov 9, 2020

If you think you're still experiencing the issue reported in a closed issue, please open up a new issue with reproduction steps

@CITGuru
Copy link

CITGuru commented Feb 10, 2021

I just bumped into this error

TypeScript error in /Users/mac/cerebro-wallet/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: Array<string>, bLines: Array<string>, options?: DiffOptions | undefined) => string;
    10 | export declare const diffLinesUnified2: (aLinesDisplay: Array<string>, bLinesDisplay: Array<string>, aLinesCompare: Array<string>, bLinesCompare: Array<string>, options?: DiffOptions | undefined) => string;
    11```

Any way to fix this

@Evie-ey
Copy link

Evie-ey commented Feb 11, 2021

I had the same issue. I was able to resolve it by installing the latest version of typescript globally.

@TripShade
Copy link

@Evie-ey Thx all of the above didn't do a thing. Your comment set me on the right path to solving this.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.