Skip to content

[@types/jasmine] Jasmine SpyOn type errors with optional methods #43486

@JiaLiPassion

Description

@JiaLiPassion

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

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

Consider the following cases.

interface Test {
  hello?: Function
}

const test: Test = {
  hello: () => {}
};

spyOn(test, 'hello'); 

will report type error, since hello can not be assigned to never.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions