From 09bb114a4d99e0349e2c1488bf79d17d1384c642 Mon Sep 17 00:00:00 2001 From: Peter Bacon Darwin Date: Sun, 12 Jul 2015 18:44:21 +0100 Subject: [PATCH] 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 --- .../processors/createTypeDefinitionFile.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/typescript-definition-package/processors/createTypeDefinitionFile.js b/docs/typescript-definition-package/processors/createTypeDefinitionFile.js index e00f9af23a..cdce0ccf70 100644 --- a/docs/typescript-definition-package/processors/createTypeDefinitionFile.js +++ b/docs/typescript-definition-package/processors/createTypeDefinitionFile.js @@ -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({