Whether or not the types are inferred depends upon the TypeScript version. Versions prior to 2.4 will not infer the types. There were a number of changes made in 2.4 that relate to generic functions. In particular, I think it is this change that effects the correct inference.

With versions prior to 2.4, you’d have to explicitly specify the type parameters:

let x: Observable<number>;
x.pipe(map<number, number>(y => y + 1));

Which lessens the appeal of lettable operators with pre-2.4 versions of TypeScript.

RxJS core team member; front-end developer; mentor; speaker; open-source contributor

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store