Import issues in latest version (25.2.0)
HobbyProjects opened this issue ยท 25 comments
๐ฅ 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
Same issue here (v 24.0.18)
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
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
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.
@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';
`
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
Can confirm this on multiple Microsoft repos
@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
Make sure you do a full clean. Delete your node_modules and package-lock file, up the version, and then npm install.
nothing helped. I have removed the package vor now and all test files that I can make a build :(
thx for your help
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 have the same issues as @HobbyProjects
Sorry about this, working on a fix
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"
Fix published in 25.2.1, sorry about the inconvenience.
I am still running into this on @jest/core 25.2.2
This issue was fixed in 25.2.3
I'm experiencing this problem with typescript 3.9.7 and jest 26.6:
โโโฌ @types/jest@26.0.15
โ โโโ jest-diff@26.6.1
โโโฌ jest@26.6.3
โโโฌ @jest/core@26.6.3
โโโฌ jest-snapshot@26.6.2
โโโ jest-diff@26.6.2
โโโฌ jest-matcher-utils@26.6.2
โโโ jest-diff@26.6.2
I'm experiencing this problem with typescript 4.0.5 and jest 26.4.2:
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
If you think you're still experiencing the issue reported in a closed issue, please open up a new issue with reproduction steps
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
I had the same issue. I was able to resolve it by installing the latest version of typescript globally.
@Evie-ey Thx all of the above didn't do a thing. Your comment set me on the right path to solving this.
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.