diff --git a/src/app/compiler/angular/deps/helpers/class-helper.ts b/src/app/compiler/angular/deps/helpers/class-helper.ts
index c2b692b8..00c14c2a 100644
--- a/src/app/compiler/angular/deps/helpers/class-helper.ts
+++ b/src/app/compiler/angular/deps/helpers/class-helper.ts
@@ -1073,6 +1073,19 @@ export class ClassHelper {
}
}
}
+ // Try to get inferred type
+ if (property.symbol) {
+ let symbol: ts.Symbol = property.symbol;
+ if (symbol.valueDeclaration) {
+ let symbolType = this.typeChecker.getTypeOfSymbolAtLocation(
+ symbol,
+ symbol.valueDeclaration
+ );
+ if (symbolType) {
+ _return.type = this.typeChecker.typeToString(symbolType);
+ }
+ }
+ }
}
if (property.kind === SyntaxKind.SetAccessor) {
// For setter accessor, find type in first parameter
diff --git a/test/fixtures/todomvc-ng2/src/app/about/about.component.html b/test/fixtures/todomvc-ng2/src/app/about/about.component.html
index f1d8ce99..2712d357 100644
--- a/test/fixtures/todomvc-ng2/src/app/about/about.component.html
+++ b/test/fixtures/todomvc-ng2/src/app/about/about.component.html
@@ -1,4 +1,4 @@
- This application is a TodoMVC example written using Angular 2, with code documented, and ready for compodoc.
+ This application is a TodoMVC example written using {{angularVersion}}, with code documented, and ready for compodoc.
diff --git a/test/fixtures/todomvc-ng2/src/app/about/about.component.ts b/test/fixtures/todomvc-ng2/src/app/about/about.component.ts
index d03d779e..2fea3d21 100644
--- a/test/fixtures/todomvc-ng2/src/app/about/about.component.ts
+++ b/test/fixtures/todomvc-ng2/src/app/about/about.component.ts
@@ -1,4 +1,4 @@
-import { Component, HostListener } from '@angular/core';
+import { Component, HostListener, Input } from '@angular/core';
import { Subscription } from 'rxjs/Subscription';
@@ -31,6 +31,11 @@ export class AboutComponent {
@HostListener('mouseup', ['$event.clientX', '$event.clientY'])
onMouseup(mouseX: number, mouseY: number): void {}
+ /**
+ * Inherited type of Angular Version
+ */
+ @Input() public angularVersion = 'Angular 2';
+
chartOptions: Highcharts.Options = {
colors: [
'#7cb5ec',
diff --git a/test/src/cli/cli-generation-big-app.spec.ts b/test/src/cli/cli-generation-big-app.spec.ts
index bcc482c6..8f5f874d 100644
--- a/test/src/cli/cli-generation-big-app.spec.ts
+++ b/test/src/cli/cli-generation-big-app.spec.ts
@@ -328,12 +328,18 @@ describe('CLI simple generation - big app', () => {
expect(todoStoreFile).to.contain('code>To');
});
- it('should have inherreturn type', () => {
+ it('should have inherit return type', () => {
expect(todoClassFile).to.contain(
'code> {
+ expect(aboutComponentFile).to.contain(
+ 'code> {
expect(tidiClassFile).to.contain('completed');
});