question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typescript mismatch with toBeTrue/toBeFalse as of @types/jasmine 3.5.0

See original GitHub issue

Description

When using recent jasmine-expect 4.0.3 with @types/jasmine 3.5.0 we get the following errors:

TypeScript error: node_modules/jasmine-expect/dist/toBeFalse.d.ts(5,13): Error TS2717: Subsequent property declarations must have the same type.  Property 'toBeFalse' must be of type '() => boolean', but here has type 'ToBeFalse'.
TypeScript error: node_modules/jasmine-expect/dist/toBeTrue.d.ts(5,13): Error TS2717: Subsequent property declarations must have the same type.  Property 'toBeTrue' must be of type '() => boolean', but here has type 'ToBeTrue'.

Suggested Solution

This seems to be due this commit https://github.com/DefinitelyTyped/DefinitelyTyped/commit/c0e76f846ea10b34f3a22a49d33cfa879ea8c0ba

Using @types/jasmine 3.4.6 for now

Help Needed

Not sure who got it right: jasmine-expect or @types/jasmine

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:10
  • Comments:6

github_iconTop GitHub Comments

3reactions
Necroskillzcommented, Feb 3, 2020

jasmine 3.5 now has it’s own toBeTrue and toBeFalse matchers, so they could just be removed from this library.

2reactions
devoto13commented, Mar 18, 2020

@JamieMason Would you be willing to accept a PR to remove expectationFailOutput?: any parameter from .toBeTrue() and .toBeFalse() matchers to prevent conflict with built-in matchers with the same name available as of Jasmine 3.5.0? This will require a major release as it is a breaking change.

Not suggesting complete removal of the matchers as Jest does not have them and also because it will affect more people then removal of the optional parameter.

For Jasmine expectationFailOutput works because of an implementation detail and is not a supported usage. That’s why Jasmine 3.3.0 introduced .withContext() as supported way to add more information to the assertion.

Not sure how does this influence Jest users of the library though.

PS I will also try to deprecated expectationFailOutput parameters in @types/jasmine package in the coming weeks. If that goes through it should be a good idea to deprecate this parameter in all jasmine-expect matchers, so people would migrate from the unsupported usage.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript mismatch with toBeTrue/toBeFalse as of @types ...
When using recent jasmine-expect 4.0.3 with @types/jasmine 3.5.0 we get the following errors: TypeScript error: node_modules/jasmine-expect/dist ...
Read more >
Jasmine errors after upgrading to Angular 8 - Stack Overflow
When I run ng test --source-map false I get the following error. What can I do to fix it? ERROR in node_modules/@types/jasmine/index.d.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found