Hello,
I have a typeScript project, which uses "typescript": "2.4.2" and "@types/jest": "^23.3.13". Previously, I had package-lock.Json, and project could be built and run without any errors. While after removing package-lock.Json, build failed with the following errors:
ERROR in /node_modules/@types/jest/index.d.ts
[tsl] ERROR in /node_modules/@types/jest/index.d.ts(39,22)
TS1005: ';' expected.
ERROR in /node_modules/@types/jest/index.d.ts
[tsl] ERROR in /node_modules/@types/jest/index.d.ts(39,46)
TS1005: '=' expected.
ERROR in /node_modules/@types/jest/index.d.ts
[tsl] ERROR /node_modules/@types/jest/index.d.ts(220,81)
TS1144: '{' or ';' expected.
ERROR in /node_modules/@types/jest/index.d.ts
[tsl] ERROR in /node_modules/@types/jest/index.d.ts(220,161)
TS1005: '(' expected.
ERROR in /node_modules/@types/jest/index.d.ts
[tsl] ERROR in /node_modules/@types/jest/index.d.ts(220,168)
TS1005: ')' expected.
I have no clue why package-lock.json matters. Any help is appreciated
I have same Issue 馃槩
I have same issue too. I can not compile when i have jest installed and added a test with describe...
Anyone out there found a resolution?
Anyone could resolve this problem?
This sounds like something that can be solved via StackOverflow.
/vote close
unless a bug is reported with more detail.
seems similar to https://github.com/facebook/create-react-app/issues/8714.
guess the @types/jest package you installed used some syntax that your typescript version not yet supported.
suggestion:
I have the similar issue . Anyone has got solution for this ?
ERROR in node_modules/jest-diff/build/diffLines.d.ts(8,13): error TS1005: '=' expected.
node_modules/jest-diff/build/diffLines.d.ts(8,34): error TS1005: ';' expected.
node_modules/jest-diff/build/index.d.ts(10,13): error TS1005: '=' expected.
node_modules/jest-diff/build/index.d.ts(10,34): error TS1005: ';' expected.
node_modules/jest-diff/build/index.d.ts(11,1): error TS1128: Declaration or statement expected.
node_modules/jest-diff/build/index.d.ts(11,13): error TS1005: ';' expected.
node_modules/jest-diff/build/index.d.ts(11,52): error TS1005: ';' expected.
node_modules/jest-diff/build/printDiffs.d.ts(8,13): error TS1005: '=' expected.
node_modules/jest-diff/build/printDiffs.d.ts(8,57): error TS1005: ';' expected.
One syntax that was recently added is import type and Jest v16 is only compatible with TS v3.8 if that helps.
Edit: sorry, I actually meant Jest v26, which only supports TS >v3.8.
See Jest鈥檚 changelog, always do that before upgrading to a new major version. Jest provides its own types with v26 so @types/jest is not needed. But it requires some additional steps, e.g. it doesn鈥檛 expose global expect, it etc. anymore AFAIK.
Thanks @anilanar i changed the jest package version to v16 but still same issue. below is my package.json
{
"name": "nop",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"build": "ng build",
"test": "npx jest",
"lint": "npx nx lint && ng lint",
"e2e": "ng e2e",
"affected:apps": "npx nx affected:apps",
"affected:libs": "npx nx affected:libs",
"affected:build": "npx nx affected:build",
"affected:e2e": "npx nx affected:e2e",
"affected:test": "npx nx affected:test",
"affected:lint": "npx nx affected:lint",
"affected:dep-graph": "npx nx affected:dep-graph",
"affected": "npx nx affected",
"format": "npx nx format:write",
"format:write": "npx nx format:write",
"format:check": "npx nx format:check",
"update": "ng update @nrwl/schematics",
"update:check": "ng update",
"workspace-schematic": "npx nx workspace-schematic",
"dep-graph": "npx nx dep-graph",
"apiLocal": "npx ng-swagger-gen -i http://localhost:50555/swagger/v1/swagger.json -o libs/nop/rest-api/src/lib",
"clients": "forever --watchDirectory server/ -w server/server.js",
"form": "npx ng s form --proxy-config proxy.config.form.json --port 4201",
"client": "npx ng s client --proxy-config proxy.config.json --port 4200",
"formdev": "npx ng s form --proxy-config proxy.config.form-dev.json --port 4201",
"clientdev": "npx ng s client --proxy-config proxy.config.client-dev.json --port 4200",
"clientlocal": "npx ng s client --proxy-config proxy.config.client-local.json --port 4200",
"help": "npx nx help"
},
"private": true,
"dependencies": {
"@angular/animations": "^8.0.0",
"@angular/cdk": "^7.0.0",
"@angular/common": "^8.0.0",
"@angular/compiler": "^8.0.0",
"@angular/core": "^8.0.0",
"@angular/forms": "^8.0.0",
"@angular/material": "^7.0.0",
"@angular/platform-browser": "^8.0.0",
"@angular/platform-browser-dynamic": "^8.0.0",
"@angular/router": "^8.0.0",
"@ng-bootstrap/ng-bootstrap": "^4.2.1",
"@ngrx-utils/store": "^0.12.1",
"@ngrx/effects": "^8.0.1",
"@ngrx/entity": "^8.0.1",
"@ngrx/router-store": "8.0.1",
"@ngrx/store": "^8.0.1",
"@ngrx/store-devtools": "^8.0.1",
"@nrwl/nx": "7.8.1",
"@progress/kendo-angular-buttons": "^4.0.0",
"@progress/kendo-angular-common": "^1.0.0",
"@progress/kendo-angular-dateinputs": "2 - 3",
"@progress/kendo-angular-dropdowns": "2 - 3",
"@progress/kendo-angular-excel-export": "1 - 2",
"@progress/kendo-angular-grid": "^4.0.0",
"@progress/kendo-angular-inputs": "2 - 3",
"@progress/kendo-angular-intl": "^1.0.0",
"@progress/kendo-angular-l10n": "^1.1.0",
"@progress/kendo-angular-pdf-export": "^1.1.1",
"@progress/kendo-angular-popup": "^2.0.0",
"@progress/kendo-data-query": "^1.0.0",
"@progress/kendo-drawing": "^1.5.6",
"@progress/kendo-theme-default": "^4.0.0",
"adal-angular4": "^4.0.9",
"angular-notifier": "^4.1.1",
"angular-star-rating": "^4.0.0-beta.3",
"applicationinsights-js": "^1.0.15",
"axios": "^0.19.0",
"bootstrap": "^4.1.0",
"classlist.js": "^1.1.20150312",
"core-js": "^2.4.1",
"css-star-rating": "^1.2.4",
"express": "^4.17.1",
"forever": "^2.0.0",
"insert-text-at-cursor": "^0.2.0",
"install": "^0.11.0",
"memoizee": "^0.4.14",
"moment": "^2.24.0",
"moment-timezone": "^0.5.23",
"mydatepicker": "1.6.19",
"ng-recaptcha": "^4.2.1",
"ng2-currency-mask": "^5.3.1",
"ngx-mask": "^2.7.3",
"parse-dms": "0.0.3",
"rxjs": "6.5.2",
"rxjs-compat": "^6.4.0",
"stacktrace-js": "^2.0.0",
"web-animations-js": "^2.3.1",
"yarn": "^1.22.4",
"zone.js": "^0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.800.1",
"@angular/cli": "8.0.1",
"@angular/compiler-cli": "~8.0.0",
"@angular/language-service": "^8.0.0",
"@nrwl/builders": "7.8.1",
"@nrwl/schematics": "7.8.1",
"@types/applicationinsights-js": "^1.0.5",
"@types/bootstrap": "4.1.2",
"@types/googlemaps": "^3.30.8",
"@types/jest": "24.0.9",
"@types/jquery": "3.3.6",
"@types/moment-timezone": "^0.5.12",
"@types/node": "~8.9.4",
"codelyzer": "~4.5.0",
"dotenv": "6.2.0",
"glob": "^7.1.4",
"jasmine-marbles": "^0.4.0",
"jest": "24.1.0",
"jest-junit": "^6.4.0",
"jest-preset-angular": "^7.1.0",
"prettier": "1.16.4",
"ts-jest": "24.0.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "3.4.5"
}
}
Thanks @anilanar! I fixed the problem after updating the typescript to version 3.8.3
Most helpful comment
I have same Issue 馃槩