fix(typings): update test.typings for abstract superclasses

This commit is contained in:
Alex Eagle
2015-10-06 19:39:44 -07:00
committed by vsavkin
parent 6075509f26
commit 5458036de7
34 changed files with 122 additions and 71 deletions

View File

@ -74,7 +74,7 @@ module.exports = new Package('angular-v2-docs', [jsdocPackage, nunjucksPackage,
references: ['./angular2.d.ts', '../jasmine/jasmine.d.ts'],
remapTypes: { Type: 'ng.Type', Binding: 'ng.Binding', ViewMetadata: 'ng.ViewMetadata', Injector: 'ng.Injector',
Predicate: 'ng.Predicate', ElementRef: 'ng.ElementRef', DebugElement: 'ng.DebugElement',
InjectableReference: 'ng.InjectableReference' },
InjectableReference: 'ng.InjectableReference', ComponentRef: 'ng.ComponentRef' },
modules: {'angular2/test_lib': {namespace: 'ngTestLib', id: 'angular2/test_lib'}}
}
];

View File

@ -59,6 +59,10 @@ DtsSerializer.prototype = {
},
interfaceOrClass: function(buffer, ast, isInterface) {
if (ast.abstract) {
buffer.push('abstract ');
}
buffer.push(isInterface ? 'interface ' : 'class ');
buffer.push(ast.name);
buffer.push(ast.typeParams);

View File

@ -223,6 +223,9 @@ module.exports = function readTypeScriptModules(tsParser, modules, getFileInfo,
if (exportSymbol.flags & ts.SymbolFlags.TypeAlias) {
exportDoc.typeDefinition = typeDefinition;
}
if (isAbstract(exportSymbol)) {
exportDoc.abstract = true;
}
// Compute the original module name from the relative file path
exportDoc.originalModule = exportDoc.fileInfo.relativePath
@ -345,6 +348,10 @@ module.exports = function readTypeScriptModules(tsParser, modules, getFileInfo,
}
}
function isAbstract(symbol) {
var declaration = symbol.valueDeclaration || symbol.declarations[0];
return declaration.flags & ts.NodeFlags.Abstract;
}
function expandSourceFiles(sourceFiles, basePath) {
var filePaths = [];