Skip to content

Commit

Permalink
chore(doc-gen): convert heritage for private constructor classes
Browse files Browse the repository at this point in the history
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 angular#2996
Closes angular#3002
  • Loading branch information
petebacondarwin committed Jul 12, 2015
1 parent 3bf8c18 commit 09bb114
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit 09bb114

Please sign in to comment.