Skip to content

Commit

Permalink
Added example of regular curried function in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Svish committed May 22, 2019
1 parent d9d1753 commit ea519d2
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions packages/eslint-plugin/docs/rules/explicit-function-return-type.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ let funcExpr: FuncType = function() {
};

let asTyped = (() => '') as () => string;
let caasTyped = <() => string>(() => '');
let castTyped = <() => string>(() => '');

interface ObjectType {
foo(): number;
Expand All @@ -145,13 +145,25 @@ let objectPropCast = <ObjectType>{
Examples of **incorrect** code for this rule with `{ allowCurrying: true }`:

```ts
var curriedAddFn = (x: number) => (y: number) => x + y;
var curriedArrowFn = (x: number) => (y: number) => x + y;

function curriedFunction(x: number) {
return function(y: number) {
return x + y;
};
}
```

Examples of **correct** code for this rule with `{ allowCurrying: true }`:

```ts
var curriedAddFn = (x: number) => (y: number): number => x + y;
var curriedArrowFn = (x: number) => (y: number): number => x + y;

function curriedFunction(x: number) {
return function(y: number): number {
return x + y;
};
}
```

## When Not To Use It
Expand Down

0 comments on commit ea519d2

Please sign in to comment.