Skip to content

mock with a private field failed #8

Closed
@luckymark

Description

@luckymark

when I do this:

class Foo { 
    private field: string
}
let mock: Foo = Substitute.for<Foo>()

I get :error TS2322: Type 'ObjectSubstitute<Pick<Foo, never>, Foo>' is not assignable to type 'Foo'.
Property 'field' is missing in type 'ObjectSubstitute<Pick<Foo, never>, Foo>'.

when I change "private" to "public", its ok!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions