Skip to content

[BUG] decorators before @Component decorator prevent Angular specific properties from being recognized #1128

@LucaVazz

Description

@LucaVazz
Overview of the issue

When any decorator is placed before the @Component decorator on a component's class, compodoc does not recognize the angular specific properties of the component class.

Operating System, Node.js, npm, compodoc version(s)

compodoc 1.1.15

Angular configuration, a package.json file in the root folder

see repository

Compodoc installed globally or locally ?

locally

If possible sourcecode of the file where it breaks

https://github.com/LucaVazz/compodoc-decorator-repro

If possible your terminal logs before the error

n/a

Motivation for or Use Case

Usefull for e.g. https://www.npmjs.com/package/@ngneat/until-destroy

Reproduce the error
  • Place any decorator before the @Component -> KO ❌
@testDecorator
@Component({
  selector: 'app-test1',
  // ...
})
export class Test1Component implements OnInit {
    @Input() text: string = '';
    // ...
}

see in generated documentation.json, Test1Component does not have an inputsClass property.

  • Only place other decorator after the @Component -> OK ✔
@Component({
  selector: 'app-test2',
  // ...
})
@testDecorator
export class Test2Component implements OnInit {
    @Input() text: string = '';
    // ...
}

see in generated documentation.json, Test2Component does have a correct inputsClass property.

Related issues

#868 was closed due to inactivity but the bug is still relevant

Suggest a Fix

PR #872 seems to fix the issue but never got merged - hopefully the reproduction repo helps with getting the issue fixed

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions