Repository: angular
Issue: Remove private properties/methods from publicApi interfaces
Labels: freq1: low,area: core,core: queries,type: confusing,P4

# 🐞 bug report

### Affected Package
All @angular packages are affected


### Is this a regression?
I am not sure, possibly at some point.


### Description

If an angular class has any private properites/methods we cannot use it, but this will prevent us creating mock of that class for testing.

## 🔬 Minimal Reproduction
```
export declare class QueryList<T> {
    readonly dirty = true; // <-- Also an error, this should be boolean
    private _results;
    readonly changes: Observable<any>;
    readonly length: number;
    readonly first: T;
    readonly last: T;
    // ...
}

export QueryListMock<T> implements QueryList<T> {
    readonly dirty = true as true;
    private _results;
    readonly changes: Observable<any>;
    readonly length: number;
    readonly first: T;
    readonly last: T;
    // ...
}
```
As this is typescript relate issue I have typescript playground: [here](https://www.typescriptlang.org/play/#src=class%20Observable%3CT%3E%20%7B%20%7D%0D%0Aclass%20BehaviorSubject%3CT%3E%20extends%20Observable%3CT%3E%20%7B%0D%0A%09value%3A%20T%3B%0D%0A%09next(v%3A%20T)%3A%20void%20%7B%20%7D%3B%0D%0A%0D%0A%09constructor(v%3A%20T)%20%7Bsuper()%7D%0D%0A%7D%0D%0A%0D%0Adeclare%20class%20QueryList%3CT%3E%20%7B%0D%0A%20%20%20%20readonly%20dirty%20%3D%20true%3B%0D%0A%20%20%20%20private%20_results%3B%0D%0A%20%20%20%20readonly%20changes%3A%20Observable%3Cany%3E%3B%0D%0A%20%20%20%20readonly%20length%3A%20number%3B%0D%0A%20%20%20%20readonly%20first%3A%20T%3B%0D%0A%20%20%20%20readonly%20last%3A%20T%3B%0D%0A%20%20%20%20%2F**%0D%0A%20%20%20%20%20*%20See%0D%0A%20%20%20%20%20*%20%5BArray.map%5D(https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FJavaScript%2FReference%2FGlobal_Objects%2FArray%2Fmap)%0D%0A%20%20%20%20%20*%2F%0D%0A%20%20%20%20map%3CU%3E(fn%3A%20(item%3A%20T%2C%20index%3A%20number%2C%20array%3A%20T%5B%5D)%20%3D%3E%20U)%3A%20U%5B%5D%3B%0D%0A%20%20%20%20%2F**%0D%0A%20%20%20%20%20*%20See%0D%0A%20%20%20%20%20*%20%5BArray.filter%5D(https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FJavaScript%2FReference%2FGlobal_Objects%2FArray%2Ffilter)%0D%0A%20%20%20%20%20*%2F%0D%0A%20%20%20%20filter(fn%3A%20(item%3A%20T%2C%20index%3A%20number%2C%20array%3A%20T%5B%5D)%20%3D%3E%20boolean)%3A%20T%5B%5D%3B%0D%0A%20%20%20%20%2F**%0D%0A%20%20%20%20%20*%20See%0D%0A%20%20%20%20%20*%20%5BArray.find%5D(https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FJavaScript%2FReference%2FGlobal_Objects%2FArray%2Ffind)%0D%0A%20%20%20%20%20*%2F%0D%0A%20%20%20%20find(fn%3A%20(item%3A%20T%2C%20index%3A%20number%2C%20array%3A%20T%5B%5D)%20%3D%3E%20boolean)%3A%20T%20%7C%20undefined%3B%0D%0A%20%20%20%20%2F**%0D%0A%20%20%20%20%20*%20See%0D%0A%20%20%20%20%20*%20%5BArray.reduce%5D(https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FJavaScript%2FReference%2FGlobal_Objects%2FArray%2Freduce)%0D%0A%20%20%20%20%20*%2F%0D%0A%20%20%20%20reduce%3CU%3E(fn%3A%20(prevValue%3A%20U%2C%20curValue%3A%20T%2C%20curIndex%3A%20number%2C%20array%3A%20T%5B%5D)%20%3D%3E%20U%2C%20init%3A%20U)%3A%20U%3B%0D%0A%20%20%20%20%2F**%0D%0A%20%20%20%20%20*%20See%0D%0A%20%20%20%20%20*%20%5BArray.forEach%5D(https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FJavaScript%2FReference%2FGlobal_Objects%2FArray%2FforEach)%0D%0A%20%20%20%20%20*%2F%0D%0A%20%20%20%20forEach(fn%3A%20(item%3A%20T%2C%20index%3A%20number%2C%20array%3A%20T%5B%5D)%20%3D%3E%20void)%3A%20void%3B%0D%0A%20%20%20%20%2F**%0D%0A%20%20%20%20%20*%20See%0D%0A%20%20%20%20%20*%20%5BArray.some%5D(https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FJavaScript%2FReference%2FGlobal_Objects%2FArray%2Fsome)%0D%0A%20%20%20%20%20*%2F%0D%0A%20%20%20%20some(fn%3A%20(value%3A%20T%2C%20index%3A%20number%2C%20array%3A%20T%5B%5D)%20%3D%3E%20boolean)%3A%20boolean%3B%0D%0A%20%20%20%20toArray()%3A%20T%5B%5D%3B%0D%0A%20%20%20%20toString()%3A%20string%3B%0D%0A%20%20%20%20reset(res%3A%20Array%3CT%20%7C%20any%5B%5D%3E)%3A%20void%3B%0D%0A%20%20%20%20notifyOnChanges()%3A%20void%3B%0D%0A%20%20%20%20%2F**%20internal%20*%2F%0D%0A%20%20%20%20setDirty()%3A%20void%3B%0D%0A%20%20%20%20%2F**%20internal%20*%2F%0D%0A%20%20%20%20destroy()%3A%20void%3B%0D%0A%7D%0D%0A%0D%0Aexport%20class%20QueryListMock%3CT%3E%20implements%20QueryList%3CT%3E%20%7B%0D%0A%09private%20get%20_results()%20%7B%20return%20this.changes.value%3B%20%7D%0D%0A%09private%20set%20_results(value%3A%20T%5B%5D)%20%7B%20this.changes.next(value)%3B%20%7D%0D%0A%0D%0A%09dirty%20%3D%20true%20as%20true%3B%0D%0A%09changes%3A%20BehaviorSubject%3CT%5B%5D%3E%3B%0D%0A%0D%0A%09constructor(initialQueryResult%3A%20T%5B%5D%20%3D%20%5B%5D)%20%7B%0D%0A%09%09this.changes%20%3D%20new%20BehaviorSubject(initialQueryResult)%3B%0D%0A%09%7D%0D%0A%0D%0A%09get%20elements()%20%7B%0D%0A%09%09return%20this.changes.value%3B%0D%0A%09%7D%0D%0A%0D%0A%09get%20length()%20%7B%0D%0A%09%09return%20this.changes.value.length%3B%0D%0A%09%7D%0D%0A%09get%20first()%20%7B%0D%0A%09%09return%20this.changes.value%5B0%5D%3B%0D%0A%09%7D%0D%0A%09get%20last()%20%7B%0D%0A%09%09return%20this.changes.value%5Bthis.length%20-%201%5D%3B%0D%0A%09%7D%0D%0A%09map%3CU%3E(fn%3A%20(item%3A%20T%2C%20index%3A%20number%2C%20array%3A%20T%5B%5D)%20%3D%3E%20U)%3A%20U%5B%5D%20%7B%0D%0A%09%09return%20this.changes.value.map(fn)%3B%0D%0A%09%7D%0D%0A%09filter(fn%3A%20(item%3A%20T%2C%20index%3A%20number%2C%20array%3A%20T%5B%5D)%20%3D%3E%20boolean)%3A%20T%5B%5D%20%7B%0D%0A%09%09return%20this.changes.value.filter(fn)%3B%0D%0A%09%7D%0D%0A%09find(fn%3A%20(item%3A%20T%2C%20index%3A%20number%2C%20array%3A%20T%5B%5D)%20%3D%3E%20boolean)%3A%20T%20%7C%20undefined%20%7B%0D%0A%09%09return%20this.changes.value.find(fn)%3B%0D%0A%09%7D%0D%0A%09reduce%3CU%3E(fn%3A%20(prevValue%3A%20U%2C%20curValue%3A%20T%2C%20curIndex%3A%20number%2C%20array%3A%20T%5B%5D)%20%3D%3E%20U%2C%20init%3A%20U)%3A%20U%20%7B%0D%0A%09%09return%20this.changes.value.reduce(fn%20as%20any)%20as%20any%3B%0D%0A%09%7D%0D%0A%09forEach(fn%3A%20(item%3A%20T%2C%20index%3A%20number%2C%20array%3A%20T%5B%5D)%20%3D%3E%20void)%3A%20void%20%7B%0D%0A%09%09return%20this.changes.value.forEach(fn)%3B%0D%0A%09%7D%0D%0A%09some(fn%3A%20(value%3A%20T%2C%20index%3A%20number%2C%20array%3A%20T%5B%5D)%20%3D%3E%20boolean)%3A%20boolean%20%7B%0D%0A%09%09return%20this.changes.value.some(fn)%3B%0D%0A%09%7D%0D%0A%09toArray()%3A%20T%5B%5D%20%7B%0D%0A%09%09return%20this.changes.value%3B%0D%0A%09%7D%0D%0A%09toString()%3A%20string%20%7B%0D%0A%09%09return%20this.changes.value.toString()%3B%0D%0A%09%7D%0D%0A%09reset(res%3A%20(any%5B%5D%20%7C%20T)%5B%5D)%3A%20void%20%7B%0D%0A%09%09this.changes.next(res%20as%20any)%3B%0D%0A%09%7D%0D%0A%09notifyOnChanges()%3A%20void%20%7B%7D%0D%0A%09setDirty()%3A%20void%20%7B%7D%0D%0A%09destroy()%3A%20void%20%7B%7D%0D%0A%7D%0D%0A)

## 🔥 Exception or Error
<pre><code>
Class 'QueryListMock<T>' incorrectly implements class 'QueryList<T>'. Did you mean to extend 'QueryList<T>' and inherit its members as a subclass?
  Types have separate declarations of a private property '_results'.
</code></pre>


## 🌍  Your Environment

**Angular Version:**
<pre><code>
Angular CLI: 7.1.2
Node: 9.11.1
OS: win32 x64
Angular: 7.2.4
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.11.2
@angular-devkit/build-angular     0.11.2
@angular-devkit/build-optimizer   0.11.2
@angular-devkit/build-webpack     0.11.2
@angular-devkit/core              7.1.2
@angular-devkit/schematics        7.1.2
@angular/cli                      7.1.2
@ngtools/webpack                  7.1.2
@schematics/angular               7.1.2
@schematics/update                0.11.2
rxjs                              6.4.0
typescript                        3.2.4
webpack                           4.23.1
</code></pre>

**Anything else relevant?**
This is due to https://github.com/Microsoft/TypeScript/issues/18499, as it seems, they wont resolve that anytime soon.