'Observable<T>' is not a class derived from 'Observable<T>'
<p>When trying to extend a class from a class in a <code>node_modules</code> the typescript compiler throws a error saying: </p>

<p><code>Property 'source' is protected but type 'Observable&lt;T&gt;' is not a class derived from 'Observable&lt;T&gt;'.</code> </p>

<p>This only happens when the base class is from a <code>node_module</code>.</p>

<p>The base class looks like:</p>

<pre><code>import {Observable} from "rxjs/Observable";
export abstract class TestBase&lt;T&gt; {

    request(options: any):Observable&lt;T&gt; {
        return Observable.throw(new Error('TestBase is abstract class. Extend it and implement own request method'));
    }
}
</code></pre>

<p>Subclassing it in a project:</p>

<pre><code>import {Observable} from "rxjs/Observable";
import {TestBase} from "@org/core";

class SocketResponse {

}

class Socket {
    request(): Observable&lt;SocketResponse&gt; {
        return new Observable.of(new SocketResponse());
    }
}

export class Sub extends TestBase&lt;SocketResponse&gt; {
    request(options:any):Observable&lt;SocketResponse&gt; {
        return new Socket().request();
    }
}
</code></pre>

<p>If the base class (<code>TestBase</code>) is moved from the <code>node_module</code> to the project it self and change the import to look like
<code>import {TestBase} from "./base";</code> The error disappears.</p>

<p>Is this due to that the compiles creates the types in different scopes for each module? I'm completely lost here.</p>

<p><strong>Update:</strong></p>

<p>This seems to only happen when linking the <code>node_modules</code> with <code>npm link</code>.
Seems like one possible workaround for the moment is to instead of returning a type in the base class to return a interface.</p>

<p>More information can be found here:</p>

<p><a href="https://github.com/Microsoft/TypeScript/issues/6496">https://github.com/Microsoft/TypeScript/issues/6496</a></p>

<p><a href="https://github.com/ReactiveX/rxjs/issues/1744">https://github.com/ReactiveX/rxjs/issues/1744</a></p>