chore(doc-gen): convert heritage for private constructor classes

When we are creating a type definition file for a class has a private constructor,
we convert it to a combination of an instance of a concrete type with no constructor and an interface that contains the other methods.

When this happens, we must also convert the class's heritage from
`implements` to `extends` since interfaces cannot implement other interfaces
or classes.

Fixes a problem with #2996
Closes #3002
This commit is contained in:
Peter Bacon Darwin 2015-07-12 18:44:21 +01:00
parent 3bf8c18c56
commit 09bb114a4d
1 changed files with 5 additions and 0 deletions

View File

@ -76,6 +76,11 @@ module.exports = function createTypeDefinitionFile(log) {
// Convert this class to an interface with no constructor
exportDoc.docType = 'interface';
exportDoc.constructorDoc = null;
if (exportDoc.heritage) {
// convert the heritage since interfaces use `extends` not `implements`
exportDoc.heritage = exportDoc.heritage.replace('implements', 'extends');
}
// Add the `declare var SomeClass extends InjectableReference` construct
modDoc.doc.exports.push({