-
-
Notifications
You must be signed in to change notification settings - Fork 416
Description
Overview of the issue
When using a custom decorator on a class already decorated with @Component(), compodoc does not read its angular specific properties
The following component does not output its @Inputs and @Outputs because of the extra @Example decorator
@Example({path: "combo-box"})
@Component({...})
export class ComboBox {
@Input() prop = "value";
}
Workaround
Make sure @Component() is the first in the decorator chain
@Component({...})
@Example({path: "combo-box"})
export class ComboBox {
@Input() prop = "value";
}
Operating System, Node.js, npm, compodoc version(s)
Not OS specific, using compodoc version 1.1.11.
Angular configuration, a package.json file in the root folder
{
"name": "vcd-ui-common",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"lint-fix": "tslint --fix \"src/**/*.ts\" --exclude \"src/main/*.ts\"",
"compodoc": "compodoc src/components/ -p tsconfig.json -e json"
},
"private": true,
"dependencies": {
"@angular/animations": "8.2.8",
"@angular/common": "8.2.8",
"@angular/compiler": "8.2.8",
"@angular/core": "8.2.8",
"@angular/forms": "8.2.8",
"@angular/platform-browser": "8.2.8",
"@angular/platform-browser-dynamic": "8.2.8",
"@angular/router": "8.2.8",
"@clr/angular": "2.2.1",
"@clr/ui": "2.2.1",
"@clr/icons": "2.2.1",
"rxjs": "6.4.0",
"tslib": "1.10.0",
"zone.js": "0.9.1",
"@webcomponents/custom-elements": "1.0.0"
},
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged"
}
},
"devDependencies": {
"@angular-devkit/build-angular": "0.803.9",
"@angular/cli": "8.3.9",
"@angular/compiler-cli": "8.2.8",
"@angular/language-service": "8.2.8",
"@compodoc/compodoc": "1.1.11",
"@types/jasmine": "3.3.8",
"@types/jasminewd2": "2.0.3",
"@types/node": "8.9.4",
"codelyzer": "5.0.0",
"husky": "3.0.9",
"jasmine-core": "3.4.0",
"jasmine-spec-reporter": "4.2.1",
"karma": "4.1.0",
"karma-chrome-launcher": "2.2.0",
"karma-coverage-istanbul-reporter": "2.0.1",
"karma-jasmine": "2.0.1",
"karma-jasmine-html-reporter": "1.4.0",
"prettier": "1.18.2",
"pretty-quick": "2.0.0",
"protractor": "5.4.0",
"ts-node": "7.0.0",
"tslint": "5.15.0",
"typescript": "3.5.3"
}
}
Compodoc installed globally or locally ?
Locally, run through npm run compodoc
If possible sourcecode of the file where it breaks
Doesn't break, just doesn't recognize @Component
If possible your terminal logs before the error
Motivation for or Use Case
I am creating an angular examples app that uses annotations to register components to be showcased.
Reproduce the error
Using the sample component above, run compodoc -e json and notice that the output does not show anything for the components["ComboBox"]inputsClass array
Related issues
Did not find any
Suggest a Fix
It looks like the code that parses the annotations needs to look at all the annotation for a class, not just the first one.
See
| if (classDeclaration.decorators) { |
The loop over decorators for a class only ever looks at the first one. If it's not a directive/component/pipe it just treats it as a regular class without ever checking the other attributes