Skip to content

Commit

Permalink
docs(lettables): add section about known issues
Browse files Browse the repository at this point in the history
In particular known issues with TS 2.3 and under not inferring types in a developer-friendly way.

closes #2869
  • Loading branch information
benlesh authored Oct 4, 2017
1 parent 5a9f4c1 commit 5dbad94
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions doc/lettable-operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,25 @@ interval(1000).pipe(
.subscribe(x => console.log(x));
// [0, 12, 24]
```

## Known Issues

In TypeScript 2.3 and lower, typings will need to be added to functions passed to operators, as types cannot be inferred prior to TypeScript 2.4. In TypeScript 2.4, types will infer via composition properly.

**TS 2.3 and under**

```ts
range(0, 10).pipe(
map((n: number) => n + '!'),
map((s: string) => 'Hello, ' + s),
).subscribe(x => console.log(x))
```

**TS 2.4 and up**

```ts
range(0, 10).pipe(
map(n => n + '!'),
map(s => 'Hello, ' + s),
).subscribe(x => console.log(x))
```

0 comments on commit 5dbad94

Please sign in to comment.