While working on my Angular service, I utilized the rxjs map and switchMap operators. When prompted by VS Code to choose between two import statements for switchMap, I opted for the first one without noticing any major differences. However, this decision led to a runtime error that was quite perplexing. After hours of debugging, I realized that the import statement could be the culprit. Switching to the second suggestion resolved the issue. What sets these two imports apart, and where do internal rxjs operators come into play?
import { switchMap } from 'rxjs/internal/operators/switchMap';
import { switchMap } from 'rxjs/operators';
I encountered a similar scenario with the CanActivate Interface, where only the latter import statement worked while the first one triggered a compile time error without much clarity.
import { CanActivate } from '@angular/router/src/utils/preactivation';
import { CanActivate } from '@angular/router';