edit Take a look at Ikhtiyor's response as it could potentially resolve the TypeScript issue. The problem I encountered was due to my oversight in subscribing and mistakenly writing the handler function within .first() directly.
Confronted with this particular error message:
Property 'first' does not exist on type Observable<{}>
I came across discussions where individuals mentioned that their problems were resolved by using the following versions:
Angular 4.2.4 + Typescript 2.3.4 + RxJS 5.4.2
Unfortunately, even after trying these versions, I still faced issues. I tested it on two different machines (one Mac, one Windows) and not even clearing node_modules and re-installing npm helped. Is anyone else encountering this same roadblock?
Below is an example code snippet:
const obs = new Observable( observer => {
setTimeout( () => {
observer.next(
[{
type: 'voting',
title: 'First dynamic resolution',
description: 'Issued by dummy web API. Dynamic data rocks.',
documents: ['a doc'],
voting:{ 'jem': -1 },
status: 'PENDING'
}, {
type: 'voting',
title: 'Other dynamic resolution',
description: 'Issued by dummy web API. We know Jem is proud.',
documents: ['another doc'],
voting:{ 'jem': -1 },
status: 'PENDING'
}]
);
}, 1000);
});
// Compilation halts here: Property 'first' does not exist on type Observable<{}>
// Mistake made: should be "obs.first().subscribe(..."
obs.first( data => {
console.log('data fetched');
});