Skip to content

Commit 62deb4a

Browse files
committed
fix: makes payload optional as documented
1 parent 327d03c commit 62deb4a

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/index.d.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export interface FluxStandardAction<Payload, Meta = undefined> {
1111
* By convention, if `error` is `true`, the `payload` SHOULD be an error object.
1212
* This is akin to rejecting a promise with an error object.
1313
*/
14-
payload: Payload;
14+
payload?: Payload;
1515
/**
1616
* The optional `error` property MAY be set to true if the action represents an error.
1717
* An action whose `error` is true is analogous to a rejected Promise.
@@ -26,7 +26,10 @@ export interface FluxStandardAction<Payload, Meta = undefined> {
2626
meta?: Meta;
2727
}
2828

29-
export interface ErrorFluxStandardAction<CustomError extends Error, Meta = undefined> extends FluxStandardAction<CustomError, Meta> {
29+
export interface ErrorFluxStandardAction<
30+
CustomError extends Error,
31+
Meta = undefined
32+
> extends FluxStandardAction<CustomError, Meta> {
3033
error: true;
3134
}
3235

@@ -38,14 +41,21 @@ export type FSA<Payload, Meta = undefined> = FluxStandardAction<Payload, Meta>;
3841
/**
3942
* Alias for ErrorFluxStandardAction.
4043
*/
41-
export type ErrorFSA<CustomError extends Error, Meta = undefined> = ErrorFluxStandardAction<CustomError, Meta>;
44+
export type ErrorFSA<
45+
CustomError extends Error,
46+
Meta = undefined
47+
> = ErrorFluxStandardAction<CustomError, Meta>;
4248

4349
/**
4450
* Returns `true` if `action` is FSA compliant.
4551
*/
46-
export function isFSA<Payload, Meta = undefined>(action: any): action is FluxStandardAction<Payload, Meta>;
52+
export function isFSA<Payload, Meta = undefined>(
53+
action: any
54+
): action is FluxStandardAction<Payload, Meta>;
4755

4856
/**
4957
* Returns `true` if `action` is FSA compliant error.
5058
*/
51-
export function isError<CustomError extends Error, Meta = undefined>(action: any): action is ErrorFluxStandardAction<CustomError, Meta>;
59+
export function isError<CustomError extends Error, Meta = undefined>(
60+
action: any
61+
): action is ErrorFluxStandardAction<CustomError, Meta>;

0 commit comments

Comments
 (0)