redux-utilities / flux-standard-action

A human-friendly standard for Flux action objects.
MIT License
4.75k stars 142 forks source link

fix: make meta optional as documented #106

Closed Arelav closed 6 years ago

Arelav commented 6 years ago

I'm providing with pull request a little example how it can be used with action creators. Because in current implementation action creator must return 'meta' explicit.

Link to Typescript playground%3B)

jack-guy commented 6 years ago

I think this should get merged! Clearly with the number of times this has come up, TypeScript users are generally confused that the type definitions do not match the documentation. If a property is truly optional, like meta, it should be defined with a question mark meta?: so we aren't littering our actions with

{
  type: 'foo',
  meta: null,
}

Incidentally, DefinitelyTyped has always had this right.

By the way, we should technically be doing the same for payload as well...

npoirey commented 6 years ago

I agree, we should merge this and do the same for payload

JaKXz commented 6 years ago

Sorry for the delay in getting this merged! I will have a patch released with teh fix for payload as well today.

JaKXz commented 6 years ago

+ flux-standard-action@2.0.3 published! Thank you for your patience everyone.