I modified @Barremian's response to type the predicate and pass on the value on tap so it functions more closely to an actual tap function:
export const isFirst = <T>(predicate: (t: T) => void) => {
let first = true;
return (source: Observable<T>) => {
return source.pipe(
tap({
next: (value: T) => {
if (first) {
predicate(value);
first = false;
}
},
}),
);
};
};