Skip to content

Optional attribute declared as required on typescript declaration #1491

@GbAlien

Description

@GbAlien

Version

3.1.0

Reproduction link

https://github.com/vuejs/vuex/blob/dev/types/index.d.ts

Steps to reproduce

Test a mutation without payload on typescript

What is expected?

Typescript not complain about missing payload

What is actually happening?

Typescript complains about missing payload


change:

export type Mutation<S> = (state: S, payload: any) => any;

to:

export type Mutation<S> = (state: S, payload?: any) => any;

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