X Tutup
Skip to content

Commit 09bb114

Browse files
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 angular#2996 Closes angular#3002
1 parent 3bf8c18 commit 09bb114

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

docs/typescript-definition-package/processors/createTypeDefinitionFile.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ module.exports = function createTypeDefinitionFile(log) {
7676
// Convert this class to an interface with no constructor
7777
exportDoc.docType = 'interface';
7878
exportDoc.constructorDoc = null;
79+
80+
if (exportDoc.heritage) {
81+
// convert the heritage since interfaces use `extends` not `implements`
82+
exportDoc.heritage = exportDoc.heritage.replace('implements', 'extends');
83+
}
7984

8085
// Add the `declare var SomeClass extends InjectableReference` construct
8186
modDoc.doc.exports.push({

0 commit comments

Comments
 (0)
X Tutup