build(docs-infra): correctly handle "pseudo" classes (#36989)

In the code base there are cases where there is, conceptually, a class
that is represented by a combination of an `interface`
(type declaration) and a `const` (value declaration).

For example:

```
export interface SomeClass {
  count(a?: string): number;
}
export const: SomeClass = class {
  someMethod(a: string = ''): number { ... }
};
```

These were being rendered as interfaces and also not
correctly showing the descriptions and default parameter
values.

In this commit such concepts are now rendered as classes.
The classes that are affected by this are:

* `DebugElement`
* `DebugNode`
* `Type`
* `EventEmitter`
* `TestBed`

Note that while decorators are also defined in this form
they have their own rendering type (`decorator`) and so
are not affecte by this.

PR Close #36989
This commit is contained in:
Pete Bacon Darwin
2020-05-13 17:01:10 +01:00
committed by Kara Erickson
parent 508c555ce2
commit f16ca1ce46
6 changed files with 226 additions and 5 deletions

View File

@ -15,6 +15,8 @@ module.exports =
new Package('angular-api', [basePackage, typeScriptPackage])
// Register the processors
.processor(require('./processors/mergeParameterInfo'))
.processor(require('./processors/processPseudoClasses'))
.processor(require('./processors/splitDescription'))
.processor(require('./processors/convertPrivateClassesToInterfaces'))
.processor(require('./processors/generateApiListDoc'))
@ -76,7 +78,6 @@ module.exports =
.config(function(
readTypeScriptModules, readFilesProcessor, collectExamples, tsParser,
packageContentFileReader) {
// Tell TypeScript how to load modules that start with with `@angular`
tsParser.options.paths = {'@angular/*': [API_SOURCE_PATH + '/*']};
tsParser.options.baseUrl = '.';
@ -181,14 +182,11 @@ module.exports =
})
.config(function(filterMembers) {
filterMembers.notAllowedPatterns.push(
/^ɵ/
);
filterMembers.notAllowedPatterns.push(/^ɵ/);
})
.config(function(computePathsProcessor, EXPORT_DOC_TYPES, generateApiListDoc) {
const API_SEGMENT = 'api';
generateApiListDoc.outputFolder = API_SEGMENT;