Definitelytyped: Error: node_modules/@types/jasmine/index.d.ts(138,47): error TS1005: ';' expected.

Created on 6 Nov 2018  ·  60Comments  ·  Source: DefinitelyTyped/DefinitelyTyped

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

I have the following errors

Error: node_modules/@types/jasmine/index.d.ts(138,47): error TS1005: ';' expected.
node_modules/@types/jasmine/index.d.ts(138,90): error TS1005: '(' expected.
node_modules/@types/jasmine/index.d.ts(138,104): error TS1005: ']' expected.
node_modules/@types/jasmine/index.d.ts(138,112): error TS1005: ',' expected.
node_modules/@types/jasmine/index.d.ts(138,113): error TS1136: Property assignment expected.
node_modules/@types/jasmine/index.d.ts(138,121): error TS1005: ')' expected.
node_modules/@types/jasmine/index.d.ts(138,147): error TS1005: '(' expected.
node_modules/@types/jasmine/index.d.ts(138,162): error TS1005: ']' expected.
node_modules/@types/jasmine/index.d.ts(138,163): error TS1005: ',' expected.
node_modules/@types/jasmine/index.d.ts(138,164): error TS1136: Property assignment expected.
node_modules/@types/jasmine/index.d.ts(138,165): error TS1136: Property assignment expected.
node_modules/@types/jasmine/index.d.ts(138,179): error TS1005: ',' expected.
node_modules/@types/jasmine/index.d.ts(138,183): error TS1005: ':' expected.
node_modules/@types/jasmine/index.d.ts(138,208): error TS1005: '{' expected.
node_modules/@types/jasmine/index.d.ts(138,217): error TS1005: ':' expected.
node_modules/@types/jasmine/index.d.ts(138,222): error TS1005: ',' expected.
node_modules/@types/jasmine/index.d.ts(138,227): error TS1005: ':' expected.
node_modules/@types/jasmine/index.d.ts(138,228): error TS1109: Expression expected.
node_modules/@types/jasmine/index.d.ts(138,230): error TS1005: ')' expected.

@armanio123

Most helpful comment

"@types/jasmine": "2.8.6" & "typescript": "2.7.2" worked.
The problem is "@types/jasmine": "~2.8.6" - > it updates to 2.8.11 incompatible with typescript to 2.7.2(require 3.+)

All 60 comments

@stefdelec Which typescript version are you using? This typings package is meant to be for TS 2.8+. I don't get those errors on latest TS

[email protected]

Shouldn't it work for this version?

Not really. The package itself says it's for TS 2.8+, and some parts of syntax used in line 138 have been first introduced in TS 2.7 (i.e. Constant-named properties) and TS 2.8 (i.e. Conditional Types).

TS 2.6.2 is pretty old, with latest version of TS being 3.1.6

I am also having same issue.But when i am trying to use higher version of typescript its throwing some other error.

@saurabhsharmaui which TS version exactly are you trying and what kind of error are you getting?

Currently i am using "typescript": "~2.3.4", and "@types/jasmine": "~2.8.1", and with this combination i am getting above error,but same thing was working fine till yesterday.
Now as per your comment i tried using higher version it got failed in npm install.
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:

npm WARN notsup Not compatible with your operating system or architecture: [email protected]

npm WARN optional Skipping failed optional dependency /live-server/chokidar/fsevents:

npm WARN notsup Not compatible with your operating system or architecture: [email protected]

npm WARN optional Skipping failed optional dependency /browser-sync/chokidar/fsevents:

npm WARN notsup Not compatible with your operating system or architecture: [email protected]

npm WARN optional Skipping failed optional dependency /gulp-watch/chokidar/fsevents:

npm WARN notsup Not compatible with your operating system or architecture: [email protected]

npm WARN optional Skipping failed optional dependency /karma/chokidar/fsevents:

npm WARN notsup Not compatible with your operating system or architecture: [email protected]

npm WARN [email protected] requires a peer of @angular/common@^2.3.0 but none was installed.

npm WARN [email protected] requires a peer of @angular/core@^2.3.0 but none was installed.

npm WARN @angular/[email protected] requires a peer of zone.js@^0.8.4 but none was installed.

npm ERR! Linux 4.4.121-92.85-default

npm ERR! argv "/opt/JE2A1/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS6.5.0/bin/node" "/opt/JE2A1/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS6.5.0/bin/npm" "install"

npm ERR! node v6.5.0

npm ERR! npm v3.10.3

npm ERR! path /home/je2adm/.npm/content-type/1.0.4/package.tgz.1017518879

npm ERR! code ENOENT

npm ERR! errno -2

npm ERR! syscall rename

npm ERR! enoent ENOENT: no such file or directory, rename '/home/je2adm/.npm/content-type/1.0.4/package.tgz.1017518879' -> '/home/je2adm/.npm/content-type/1.0.4/package.tgz'

npm ERR! enoent ENOENT: no such file or directory, rename '/home/je2adm/.npm/content-type/1.0.4/package.tgz.1017518879' -> '/home/je2adm/.npm/content-type/1.0.4/package.tgz'

npm ERR! enoent This is most likely not a problem with npm itself

npm ERR! enoent and is related to npm not being able to find a file.

npm ERR! enoent

Looks like problem with jenkins' installation of npm, similar problems have been reported previously (i.e. here or here) and it might not be directly connected to typescript. One of suggested fixes was to completely reinstall npm.

Are you installing TS globally or locally for your project? Have you tried removing node_modules and package-lock.json, clearing npm cache (npm cache clean --force) and reinstalling dependencies?

Hi @burtek Thanks you very much for your support.I checked version history and i see they have updated to newer version yesterday because of that changes it was getting failed i went back and changed to 2.8.9 its working fine.

@saurabhsharmaui glad I could help

@stefdelec have you been able to get it working?

Hi. I have same issue. typescript: 2.9.2 and @types/jasmine: 2.8.9. Have no idea how to fix it. Tried all above, nothing help

I have the same error at work.
I am working on a generated template for base project. So a brand new project is breaking today but dit not yesterday.

Extract of my package.json

...
    "devDependencies": {
        "@angular-devkit/build-angular": "~0.6.8",
        "@angular/cli": "~6.0.8",
        "@angular/compiler-cli": "^6.0.3",
        "@angular/language-service": "^6.0.3",
        "@types/jasmine": "~2.8.6",
        "@types/jasminewd2": "~2.0.3",
        "@types/node": "~8.9.4",
...
        "jasmine-core": "~2.99.1",
        "jasmine-spec-reporter": "~4.2.1",
        "karma": "^3.0.0",
        "karma-chrome-launcher": "~2.2.0",
        "karma-coverage-istanbul-reporter": "~2.0.0",
        "karma-jasmine": "~1.1.1",
        "karma-jasmine-html-reporter": "^0.2.2",
...
        "ts-node": "~5.0.1",
        "tslint": "~5.9.1",
        "typescript": "~2.7.2"
    },
...

@vnazarchukmob is it possible you have typescript installed both globally and locally and one of them is below 2.8?

@mowgliLab as I mentioned above, @types/jasmine is for TS 2.8+, while you're still using TS 2.7.x. Upgrade typescript to at least 2.8.0.

@mowgliLab The problem is, the current version 2.8.11 which requires TS 2.8 satisfies your semver of ~2.8.6, so while running npm install on a template with ~2.8.6 dependency, version 2.8.11 would be installed. It might have worked for older projects (which got lower version of @types/jasmine installed), but creating new ones with your template is now broken, since it would grab version of 2.8.11, which is incompatible with TS 2.7.2. You should update the template you use to use TS of at least 2.8.x branch (I recommend using the latest TS of 3.1.x branch as it comes with lots of new features, improvements and fixes compared to 2.7.x)

@burtek yes, it was installed globally with lower version 2.3.4. I upgraded it to 3.1.6. but it doesn't help

@vnazarchukmob just to be sure: You have globally installed TS 3.1.6, locally installed TS 2.9.2, locally installed @types/jasmine of 2.8.9 and you're getting the error from first post. Is that correct?

Ok, I will check if it's ok tu upgrade for new projects.
I've tested with typescript 3.1.6 and it works.

Thank you @burtek

@mowgliLab glad I could help

@burtek yep

Last thing that comes to my mind is to reinstall node_modules, but I'm not sure that's gonna help. I'm out of ideas 😢

@armanio123, do you have any idea?

same issue , started yesterday.

@r3hxn Did you read the conversation? Please make sure you're using TS of at least 2.8

@r3hxn Did you read the conversation? Please make sure you're using TS of at least 2.8

thanks , am working through it, the problem seems to only appear on our Jenkins pipeline

@r3hxn if you don't want to change typescript version just change @type/jasmine version to 2.8.9.It will work fine. Here problem is with new release of @type/jasmine which needs higher version of typescript.

thanks @saurabhsharmaui that helps

@r3hxn glad I could help.

I had the same issue, upgrading typescript to latest helps.
The problem is Angular 6 using TS 2.7.2 AFAIK, so all new apps created by ng new from version ~6.0.0 will have this issue.

@r3hxn Did you read the conversation? Please make sure you're using TS of at least 2.8

thanks , am working through it, the problem seems to only appear on our Jenkins pipeline

We're experiencing the very same thing: works on the dev machines, but not on Jenkins.

I understand your desire to move to a more recent TS, but doing it in a minor releases screws over a lot of folks.

As a side note, upgrading these types to _require_ TS 2.8+ is not a minor release, this has broken many projects which now need to pin to an older types/jasmine version.
This was a major breaking change and should of been a new major version number 😢

Pinning to 2.8.3 and leaving TS on a project that couldn't go beyond 2.5.3 worked.

@types/jasmine to 2.8.8 and typescript to 2.6.2 worked for me

"@types/jasmine": "2.8.3" with the same typescript as it was before did the trick for me.
Thanks @MarkPieszak

"@types/jasmine": "2.8.6" & "typescript": "2.7.2" worked.
The problem is "@types/jasmine": "~2.8.6" - > it updates to 2.8.11 incompatible with typescript to 2.7.2(require 3.+)

After updating "typescript": "^3.1.6" and "@types/jasmine": "^2.8.11" Builds succeeded in tfs build servers

We also got bit by this in the last few days.

"@types/jasmine": "^2.8.8",
"typescript": "~2.7.2",

It becomes very confusing when 2.8.8 and 2.8.9 support different TS versions... amiright?!

screen shot 2018-11-08 at 10 22 54 am

We also ran into this issue, and I have to say that relying on a new typescript version should be considered a breaking change meaning the package version (according to semver) should have been bumped to 3.X.X instead of the patch version it received. This causes a lot of issues for people which could have been avoided making it an inexcusable error.

we are having the same issues I have done everything suggested above but it is not working.
Anyone has any idea what to do...

I ran into this problem beginning yesterday, and due to this thread being of recent I assumed it was with some versioning changes as several have mentioned above. I had the exact same issues, however, I hadn't updated any TS or Jasmine Types packages recently. Mine was an issue with npm locally, so I ran the following to get things sorted and my errors went away:

npm cache verify

Resolved this by updating typescript to 3.1.6 and jasmine to 3.3.0

Not really. The package itself says it's for TS 2.8+, and some parts of syntax used in line 138 have been first introduced in TS 2.7 (i.e. Constant-named properties) and TS 2.8 (i.e. Conditional Types).

TS 2.6.2 is pretty old, with latest version of TS being 3.1.6

@burtek Thank you for taking the time to help identify the issue and also for the work that you do on this library. I know its a thankless job when issues arise.

I am bit concerned that a breaking change like this got published to a patch release version. TS 2.5+ is not really THAT old and a lot of projects are using it. Also its not a valid path forward for a lot of projects to "upgrade typescript". We often are constrained by our work and something like that requires heavy regression testing. Its disconcerting to have a build suddenly break with no warning.

My understanding of semver is that anything that breaks backwards compat should be treated as a major version. Why was that convention not followed here? Should we expect that convention to not be followed with this library?

Thanks again for all your help.

@jeffskelton3 It wasn't me who worked on this change, nor did I merge and publish it. I just came by looking for a different issue and found a possible reason for this one. I have also nothing to do with this package itself. Those questions and notes should be addressed at the person who introduced this change, as well as DefinitelyTyped maintainers.

That being said, I totally agree with everything that has been said in this thread. It's just neither my fault, nor my responsibility; I tried to help JS community as best as I could

@burtek apologies for directing the question at the wrong person (I must have read wrong that you were a contributor to this code base doh!). Appreciate your agreement with my sentiment and you helping everyone track down the cause of this issue.

@jeffskelton3 no worries

I have the same problem two days ago. Nothing changed on my project package.json, suddenly, it fails to package with the error.

Property 'toContainEqual' does not exist on type 'ArrayLikeMatchers
Property 'toContainEqual' does not exist on type 'ArrayLikeMatchers

googled for two days, then come here, but still not resolved.

As another reference point, NativeScript currently targets TypeScript ~2.7.2. Setting up a project using the NativeScript-CLI defaults to Jasmine as the default testing framework. So just another vote to ensure that minor version updates don't also require updates to other packages. Thanks!

I had this issue just in travis enviroment and changin to 2.5.38 worked!

https://travis-ci.org/mariohmol/ng-gantt/builds/459888259

Had same issue when running "ng test". Went to node_modules/@types/jasmine/index.d.ts.
On line 11 it says "// TypeScript Version: 2.8"

So I
C:\my-project-directory> npm install [email protected]
and that fixed the issue.

I'm also running into the same errors as above. Here's the CI output:

It's working well locally (as some above message mentions) but on GitLab CI, it's definitely broken... 🤕

06 12 2018 15:34:42.681:ERROR [karma]: Error: node_modules/@types/jasmine/index.d.ts(138,47): error TS1005: ';' expected.
node_modules/@types/jasmine/index.d.ts(138,90): error TS1005: '(' expected.
node_modules/@types/jasmine/index.d.ts(138,104): error TS1005: ']' expected.
node_modules/@types/jasmine/index.d.ts(138,112): error TS1005: ',' expected.
node_modules/@types/jasmine/index.d.ts(138,113): error TS1136: Property assignment expected.
node_modules/@types/jasmine/index.d.ts(138,121): error TS1005: ')' expected.
node_modules/@types/jasmine/index.d.ts(138,147): error TS1005: '(' expected.
node_modules/@types/jasmine/index.d.ts(138,162): error TS1005: ']' expected.
node_modules/@types/jasmine/index.d.ts(138,163): error TS1005: ',' expected.
node_modules/@types/jasmine/index.d.ts(138,164): error TS1136: Property assignment expected.
node_modules/@types/jasmine/index.d.ts(138,165): error TS1136: Property assignment expected.
node_modules/@types/jasmine/index.d.ts(138,179): error TS1005: ',' expected.
node_modules/@types/jasmine/index.d.ts(138,183): error TS1005: ':' expected.
node_modules/@types/jasmine/index.d.ts(138,208): error TS1005: '{' expected.
node_modules/@types/jasmine/index.d.ts(138,217): error TS1005: ':' expected.
node_modules/@types/jasmine/index.d.ts(138,222): error TS1005: ',' expected.
node_modules/@types/jasmine/index.d.ts(138,227): error TS1005: ':' expected.
node_modules/@types/jasmine/index.d.ts(138,228): error TS1109: Expression expected.
node_modules/@types/jasmine/index.d.ts(138,230): error TS1005: ')' expected.

    at Compiler.compiler.plugin (/var/www/cadi-front/node_modules/@angular/cli/plugins/karma-webpack-throw-error.js:10:23)
    at Compiler.applyPlugins (/var/www/cadi-front/node_modules/tapable/lib/Tapable.js:61:14)
    at Watching._done (/var/www/cadi-front/node_modules/webpack/lib/Compiler.js:105:17)
    at onCompiled (/var/www/cadi-front/node_modules/webpack/lib/Compiler.js:55:18)
    at applyPluginsAsync.err (/var/www/cadi-front/node_modules/webpack/lib/Compiler.js:510:14)
    at next (/var/www/cadi-front/node_modules/tapable/lib/Tapable.js:202:11)
    at Compiler.<anonymous> (/var/www/cadi-front/node_modules/webpack/lib/CachePlugin.js:78:5)
    at Compiler.applyPluginsAsyncSeries (/var/www/cadi-front/node_modules/tapable/lib/Tapable.js:206:13)
    at compilation.seal.err (/var/www/cadi-front/node_modules/webpack/lib/Compiler.js:507:11)
    at Compilation.applyPluginsAsyncSeries (/var/www/cadi-front/node_modules/tapable/lib/Tapable.js:195:46)
    at applyPluginsAsync.err (/var/www/cadi-front/node_modules/webpack/lib/Compilation.js:677:19)
    at Compilation.applyPluginsAsyncSeries (/var/www/cadi-front/node_modules/tapable/lib/Tapable.js:195:46)
    at applyPluginsAsync.err (/var/www/cadi-front/node_modules/webpack/lib/Compilation.js:668:11)
    at Compilation.applyPluginsAsyncSeries (/var/www/cadi-front/node_modules/tapable/lib/Tapable.js:195:46)
    at applyPluginsAsync.err (/var/www/cadi-front/node_modules/webpack/lib/Compilation.js:663:10)
    at Compilation.applyPluginsAsyncSeries (/var/www/cadi-front/node_modules/tapable/lib/Tapable.js:195:46)
(node:88) [DEP0079] DeprecationWarning: Custom inspection function on Objects via .inspect() is deprecated
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.

EDIT:
I locked the @types/jasmine version to 2.8.4 and all seems to be okay. 👌 I was unable to upgrade the version of typescript.

"@types/jasmine": "2.8.6" & "typescript": "2.7.2" worked.
The problem is "@types/jasmine": "~2.8.6" - > it updates to 2.8.11 incompatible with typescript to 2.7.2(require 3.+)

No... @angular/[email protected] requires a peer of typescript@>=2.4.2 <2.7 but none is installed. You must install peer dependencies yourself.

Cannot have typescript higher than 2.7...

"@types/jasmine": "2.8.6" & "typescript": "2.7.2" worked.
The problem is "@types/jasmine": "~2.8.6" - > it updates to 2.8.11 incompatible with typescript to 2.7.2(require 3.+)

I needed to pin to 2.8.9 to be usable with typescript 2.6.x, which is needed for my angular 5 project

@vnazarchukmob is it possible you have typescript installed both globally and locally and one of them is below 2.8?

@mowgliLab as I mentioned above, @types/jasmine is for TS 2.8+, while you're still using TS 2.7.x. Upgrade typescript to at least 2.8.0.

LGTM~

The version 2.8.8 works fine with [email protected], but 2.8.12 doesn't.

I am wondering how come a patch version can introduce such a breaking change 😞

I'm encountering this issue with a brand new Angular app using "@types/jasmine": "~2.8.6" and "typescript": "^2.8.4". Has anyone resolved this yet?

Is there still no solution? Can someone recap for a final solution; what need o be doen on a brand new install? I am a bit lost.

I found out all errors are gone when checking the project with this error out on Mac and running Yarn as the package manager

@wluijk add

{
  "typeRoots": [
    "./node_modules/@types"
  ],
  "types": ["node"]
}

In your compilerOptions and be sure to have @types/node installed

As a side note, upgrading these types to _require_ TS 2.8+ is not a _minor_ release, this has broken many projects which now need to pin to an older types/jasmine version.
This was a major breaking change and should of been a new major version number 😢

Pinning to 2.8.3 and leaving TS on a project that couldn't go beyond 2.5.3 worked.

Worked like a charm! Thanks a bunch friend

As a side note, upgrading these types to _require_ TS 2.8+ is not a _minor_ release, this has broken many projects which now need to pin to an older types/jasmine version.
This was a major breaking change and should of been a new major version number cry

Pinning to 2.8.3 and leaving TS on a project that couldn't go beyond 2.5.3 worked.

I had entry "@types/jasmine": "~2.8.3" in package json and it was throwing an error.

I removed tilt and made it "@types/jasmine": "2.8.3" and it worked.

Note: "~2.8.3" was being updated to 2.8.11.

@jayvdb

I needed to pin to 2.8.9 to be usable with typescript 2.6.x, which is needed for my angular 5 project

Yes it works, but now I have warning in my console that:

angular/[email protected] requires typescript@'>=2.4.2 <2.5.0' but 2.6.2 was found instead.
Using this version can result in undefined behaviour and difficult to debug problems.

@mieszczans , I found typescript 2.6 was fairly stable with our angular 5 app, so we ignored that warning. If it causes problems for you, pin the @types/jasmine to 2.8.4 as mentioned at https://github.com/DefinitelyTyped/DefinitelyTyped/issues/30310#issuecomment-444916003

Really, this should be reverted, as a crass violation of SemVer.

Hi All,

You have just change [email protected] and @types/[email protected]

Like

  1. npm install typescript/2.8.4 --save-dev
  2. npm install @types/[email protected] --save-dev

It's working 100%.

Thanks,

Jasmine 2.8.9 along with typescript 2.80 working for me

Was this page helpful?
0 / 5 - 0 ratings