When I was looking through the rxjs library I stumbled across this function:
export function map<T, R>(this: Observable<T>, project: (value: T, index: number) => R, thisArg?: any): Observable<R> {
if (typeof project !== 'function') {
throw new TypeError('argument is not a function. Are you looking for `mapTo()`?');
}
return this.lift(new MapOperator(project, thisArg));
}
source: https://github.com/ReactiveX/rxjs/blob/master/src/operator/map.ts
I'm wondering what really happens when passing an argument named this.
Is it just treated like any other parameter or does typescript some special actions when you do this?