Definitelytyped: [@types/jasmine] Latest change in 3.3.4 breaks tests

Created on 19 Dec 2018  路  1Comment  路  Source: DefinitelyTyped/DefinitelyTyped

In the most recent change to the Jasmine types, the behavior of SpyObj has removed the ability for me to Spy on some classes.

Example: I am spying on MatExpansionPanel from @angular/material/expansion/typings/expansion-panel.

I am creating the Spy with:

let matExpansionPanelMock: jasmine.SpyObj<MatExpansionPanel>;
matExpansionPanelMock = jasmine.createSpyObj<MatExpansionPanel>('MatExpansionPanel', ['_getExpandedState', 'open', 'close']);

However, when I try to do anything with the matExpansionPanelMock, I am left with the error:

TS2345: Argument聽of聽type聽'SpyObj<MatExpansionPanel>'聽is聽not聽assignable聽to聽parameter聽of聽type聽'MatExpansionPanel'. 聽聽Property聽'_viewContainerRef'聽is聽missing聽in聽type聽'SpyObj<MatExpansionPanel>'.

This only showed up after [@types/jasmine] was updated from 3.3.3 -> 3.3.4. I believe these are the changes that are causing my issue, but I'm unsure if it's a bug or a new convention.

https://github.com/DefinitelyTyped/DefinitelyTyped/commit/d89ab9a678475a2aa97041ee5c33fb8997efcb74#diff-9e4053693e748b8ffdb3e9eb9d9299e8

  • [x] I tried using the @types/jasmine package and had problems.
  • [x] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript (3.1.6 latest for Angular 7)
  • [x] I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
  • [x] [Mention](https://github.com/blog/821-mention-somebody-they-re-notified) the authors (see Definitions by: in index.d.ts) so they can respond.

    • Authors: @fdim

If you do not mention the authors the issue will be ignored.

Most helpful comment

The fix is on it's way

>All comments

The fix is on it's way

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fasatrix picture fasatrix  路  3Comments

jgoz picture jgoz  路  3Comments

ArtemZag picture ArtemZag  路  3Comments

variousauthors picture variousauthors  路  3Comments

JWT
svipas picture svipas  路  3Comments