Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional attribute declared as required on typescript declaration #1491

Closed
GbAlien opened this issue Jan 23, 2019 · 0 comments
Closed

Optional attribute declared as required on typescript declaration #1491

GbAlien opened this issue Jan 23, 2019 · 0 comments

Comments

@GbAlien
Copy link

GbAlien commented Jan 23, 2019

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;

davidsandoz added a commit to davidsandoz/vuex that referenced this issue Mar 7, 2019
When testing a mutation without payload in TypeScript, it complains that about the missing payload, even though it's not mandatory.

This PR simply makes the payload optional.

Fixes vuejs#1491
ktsn pushed a commit that referenced this issue Mar 10, 2019
…ile (#1517)

* Make mutation payload optional in definition file

When testing a mutation without payload in TypeScript, it complains that about the missing payload, even though it's not mandatory.

This PR simply makes the payload optional.

Fixes #1491

* Make action payload optional in definition file
vaga pushed a commit to vaga/vuex that referenced this issue Apr 20, 2020
…ile (vuejs#1517)

* Make mutation payload optional in definition file

When testing a mutation without payload in TypeScript, it complains that about the missing payload, even though it's not mandatory.

This PR simply makes the payload optional.

Fixes vuejs#1491

* Make action payload optional in definition file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant