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

Error in StandardAction generic type definition ? #148

Open
skurgansky-sugarcrm opened this issue Jun 20, 2019 · 7 comments
Open

Error in StandardAction generic type definition ? #148

skurgansky-sugarcrm opened this issue Jun 20, 2019 · 7 comments

Comments

@skurgansky-sugarcrm
Copy link

current type definitions version

export type Action<
  Type extends string = string,
  Payload extends Object = undefined,
  Meta extends Object = undefined
> =
  | ErroneousAction<Type, Meta>
  | (StandardAction<Type, Payload, Meta> & { error?: false });

error:

Argument of type 'ActionMeta<IReceiveContactPayload, IPersistMetadata>' is not assignable to parameter of type 'ArgumentAction<string, undefined, undefined>'.
  Type 'ActionMeta<IReceiveContactPayload, IPersistMetadata>' is not assignable to type 'ActionBasis<string> & Partial<ActionBasis<string> & { payload: object; } & { meta: object; } & { error?: false; }>'.
    Type 'ActionMeta<IReceiveContactPayload, IPersistMetadata>' is not assignable to type 'Partial<ActionBasis<string> & { payload: object; } & { meta: object; } & { error?: false; }>'.
      Types of property 'error' are incompatible.
        Type 'boolean' is not assignable to type 'false'.ts(2345)

i think it should be (StandardAction<Type, Payload, Meta> & { error?: boolean }); ?

@skurgansky-sugarcrm
Copy link
Author

yeah. I use redux-actions latest version and i suppose they have conflict here.

@skurgansky-sugarcrm
Copy link
Author

skurgansky-sugarcrm commented Jun 21, 2019

btw why payload have to be object in createLogic config ? seems wrong

@emj365
Copy link

emj365 commented Jul 15, 2019

error is only true or undefined, that's the standard

@skurgansky-sugarcrm
Copy link
Author

ping

@emj365
Copy link

emj365 commented Aug 9, 2019

redux-logic type more strict, like https://github.com/redux-utilities/flux-standard-action

@skurgansky-sugarcrm
Copy link
Author

redux-logic type doesn't say & { error?: true } like its described in flux-standard-action (FSA)

The optional error property MAY be set to true if the action represents an error.

An action whose error is true is analogous to a rejected Promise. By convention, the payload SHOULD be an error object.

If error has any other value besides true, including undefined and null, the action MUST NOT be interpreted as an error.

It says & { error?: false }
why ?

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

2 participants