Skip to content

Commit

Permalink
declare type with a covariant property
Browse files Browse the repository at this point in the history
  • Loading branch information
rgbkrk committed Sep 13, 2017
1 parent 7ca768b commit 6e4f63a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 16 additions & 1 deletion packages/nbextension/nteract_on_jupyter/epics/contents.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ type LOAD_ACTION = {
path: string
};

type LOAD_FAILED_ACTION = {
type: "LOAD_FAILED",
payload: any,
status: number
};

type LOADED_ACTION = {
type: "LOADED",
payload: any
};

function save(path: string, model: any): SAVE_ACTION {
// NOTE: Model can be a notebook or any ol' file
// TODO: Should serverConfig be passed everytime or yoinked from the store from within the epic (?)
Expand All @@ -50,7 +61,11 @@ function load(path: string): LOAD_ACTION {
};
}

type CONTENTS_ACTION = SAVE_ACTION | LOAD_ACTION;
type CONTENTS_ACTION =
| SAVE_ACTION
| LOAD_ACTION
| LOAD_FAILED_ACTION
| LOADED_ACTION;

type ServerConfig = {
endpoint: string,
Expand Down
2 changes: 1 addition & 1 deletion types/redux.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* eslint-disable no-undef */

declare type Action = {
type: string
+type: string
};

declare type Dispatch<A: Action> = (action: A) => A;

0 comments on commit 6e4f63a

Please sign in to comment.