Skip to content

Commit

Permalink
fixing fantasy-land spec compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
pfgray committed Sep 12, 2018
1 parent c1dc77f commit 44d6202
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/ChainableComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,34 @@ export type ChainableComponent<A> = {
* f will replace the existing in a new Chainable Component which is returned.
*/
map<B>(f: (a: A) => B): ChainableComponent<B>;
/**
* @deprecated: use fantasy-land/map instead
*/
'fantasyland/map'<B>(f: (a: A) => B): ChainableComponent<B>;
'fantasy-land/map'<B>(f: (a: A) => B): ChainableComponent<B>;

/**
* Converts the value inside this Chainable Component.
* @param c Apply the function inside of c to the value inside of this Chainable Component
*/
ap<B>(c: ChainableComponent<(a: A) => B>): ChainableComponent<B>;
/**
* @deprecated: use fantasy-land/ap instead
*/
'fantasyland/ap'<B>(c: ChainableComponent<(a: A) => B>): ChainableComponent<B>;
'fantasy-land/ap'<B>(c: ChainableComponent<(a: A) => B>): ChainableComponent<B>;

/**
* Composes or 'chains' another Chainable Component along with this one.
* @param f A function which is provided the contextual value, and returns a chainable component
* The result if this function will be returned.
*/
chain<B>(f: (a: A) => ChainableComponent<B>): ChainableComponent<B>;
/**
* @deprecated: use fantasy-land/ap instead
*/
'fantasyland/chain'<B>(f: (a: A) => ChainableComponent<B>): ChainableComponent<B>;
'fantasy-land/chain'<B>(f: (a: A) => ChainableComponent<B>): ChainableComponent<B>;
};

/**
Expand Down Expand Up @@ -246,8 +258,11 @@ export function fromRender<A>(render: (f: (a: A) => React.ReactNode) => React.Re
return {
...cc,
'fantasyland/map': cc.map,
'fantasy-land/map': cc.map,
'fantasyland/ap': cc.ap,
'fantasy-land/ap': cc.ap,
'fantasyland/chain': cc.chain,
'fantasy-land/chain': cc.chain,
toRenderProp() {
return toRenderProp(this);
},
Expand Down Expand Up @@ -402,7 +417,11 @@ export const ChainableComponent = {
* @param a the value that provides the context.
*/
of,
/**
* @deprecated: use fantasy-land/of instead
*/
'fantasyland/of': of,
'fantasy-land/of': of,
all,
Do,
};

0 comments on commit 44d6202

Please sign in to comment.