Currently in Angular v8 and encountering an issue with my model.ts
file structure, which includes the following code:
import {map} from 'rxjs/operators';
export class Person {
constructor() { }
}
In addition, I have a WebWorker file called test.worker.ts
with the following content:
/// <reference lib="webworker" />
import {Person} from './bo/model';
addEventListener('message', ({ data }) => {
const response = `worker response to ${data}`;
postMessage(response);
});
An error is triggered when running ng compile
, specifically related to the import statement
import {map} from 'rxjs/operators'
. This leads to a TS2339 error regarding property 'observable' not existing on type 'SymbolConstructor.'
Upon commenting out the troublesome import and including
import {HttpClient} from '@angular/common/http';
, a different set of errors arise, such as those related to missing names like 'Element' and 'Node'.
Surprisingly, importing
import {Observable, of} from 'rxjs';
results in no errors at all. The conflicting behaviors raise questions about the limitations on importing libraries within Angular applications, especially when it comes to dependencies.
Please note that this scenario takes place within ng-cli version 8.0.2.