question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] CompoDoc not inheriting docs from implemented Interfaces

See original GitHub issue
Overview of the issue

When a class A implements Interface B, the interface-documentation does not get inherited to the implemented class properties:

// documented-interface.ts
export interface DocumentedInterface {
  /** Some docs for the property, that does not get inherited into implementing classes. :( */
  test: boolean;
}

// my-class.ts
import { DocumentedInterface } from '.';

/** The "test"-property will not be documented in compodoc output, even that the interface provides docs for it.  */
export class MyClass implements DocumentedInterface {
  public test = true;
}

image

Operating System, Node.js, npm, compodoc version(s)
  • OS: Windows 10
  • npm: 6.13.2
  • Nodejs: 12.13.1
  • CompoDoc: 1.1.11
Angular configuration, a package.json file in the root folder
  • Please note: Changed the real project name to “package-name”, for legal reasons. But there is nothing special with the name, so should not be relevant here anyway.

angular.json:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "package-name": {
      "root": "projects/package-name",
      "sourceRoot": "projects/package-name/src",
      "projectType": "library",
      "prefix": "package-name",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-ng-packagr:build",
          "options": {
            "tsConfig": "projects/package-name/tsconfig.lib.json",
            "project": "projects/package-name/ng-package.json"
          }
        },
        "test": {
          "builder": "@angular-builders/jest:run"
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": ["projects/package-name/tsconfig.lib.json", "projects/package-name/tsconfig.spec.json"],
            "exclude": ["**/node_modules/**"]
          }
        }
      }
    }
  },
  "schematics": {
    "@schematics/angular:component": {
      "styleext": "scss"
    }
  },
  "defaultProject": "package-name"
}

tsconfig.json & tsconfig.lib.json:

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "downlevelIteration": true,
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "esnext",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es2015",
    "typeRoots": ["node_modules/@types"],
    "types": ["jest", "mdx"],
    "lib": ["es2018", "dom"],
    "paths": {
      "package-name": ["dist/package-name"],
      "package-name/*": ["dist/package-name/*"]
    }
  },
  "exclude": ["dist"]
}
{
  "extends": "../../tsconfig.json",
  "compilerOptions": {
    "outDir": "../../out-tsc/lib",
    "target": "es2015",
    "module": "es2015",
    "moduleResolution": "node",
    "declaration": true,
    "sourceMap": true,
    "inlineSources": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "types": [],
    "lib": ["dom", "es2018"]
  },
  "angularCompilerOptions": {
    "annotateForClosureCompiler": true,
    "skipTemplateCodegen": true,
    "strictMetadataEmit": true,
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true,
    "enableResourceInlining": true
  },
  "exclude": ["**/*.spec.ts", "**/spec.functions.ts"]
}

package.json:

{
  "name": "package-name",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "doc": "compodoc -p projects/package-name/tsconfig.lib.json -s",
    "doc:json": "compodoc -p projects/package-name/tsconfig.lib.json -e json -d ."
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~8.2.14",
    "@angular/cdk": "~8.2.3",
    "@angular/common": "~8.2.14",
    "@angular/compiler": "~8.2.14",
    "@angular/core": "~8.2.14",
    "@angular/forms": "~8.2.14",
    "@angular/material": "~8.2.3",
    "@angular/platform-browser": "~8.2.14",
    "@angular/platform-browser-dynamic": "~8.2.14",
    "@angular/router": "~8.2.14",
    "core-js": "^2.5.4",
    "hammerjs": "^2.0.8",
    "react": "^16.12.0",
    "rxjs": "~6.5.3",
    "tslib": "^1.9.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-builders/jest": "^8.3.1",
    "@angular-devkit/build-angular": "~0.803.19",
    "@angular-devkit/build-ng-packagr": "~0.803.19",
    "@angular/cli": "^8.3.19",
    "@angular/compiler-cli": "~8.2.14",
    "@angular/language-service": "~8.2.14",
    "@babel/core": "^7.7.2",
    "@compodoc/compodoc": "^1.1.10",
    "@storybook/addon-actions": "^5.3.6",
    "@storybook/addon-docs": "^5.3",
    "@storybook/addons": "^5.3",
    "@storybook/angular": "^5.3",
    "@types/jest": "^24.0.23",
    "@types/node": "~8.9.4",
    "babel-loader": "^8.0.6",
    "codelyzer": "^5.0.1",
    "copy-webpack-plugin": "^5.0.5",
    "cross-env": "^6.0.3",
    "css-loader": "^3.2.1",
    "fs-extra": "^8.1.0",
    "ignore-not-found-export-webpack-plugin": "^1.0.1",
    "jest": "^24.9.0",
    "ng-packagr": "^5.7.1",
    "prettier": "^1.19.1",
    "scss-bundle": "^3.0.2",
    "shx": "^0.3.2",
    "ts-node": "~7.0.0",
    "tsickle": "^0.37.0",
    "tslint": "~5.11.0",
    "typescript": "~3.5.3"
  }
}

Compodoc installed globally or locally ?
  • locally
If possible sourcecode of the file where it breaks

See example above configs

If possible your terminal logs before the error
  • no error output.
Motivation for or Use Case
  • Don’t want to have to manually copy over all docs from interfaces into my classes implementing them.
  • This is error-prone and very likely to get out of sync soon; also it is really tedious to do so.
Reproduce the error
  1. Create an Interface containing one property that is documented.
  2. Create a class that implements that interface, but do not add docs to the implemented property.
  3. Generate docs using compodoc and see the result: The classes’ property appears undocumented.
Related issues
Suggest a Fix
  • Sorry, no idea about that

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
ghostcommented, Jun 4, 2020

@manekinekko any thoughts on adding this?

1reaction
sleidigcommented, Mar 28, 2020

Is there any chance for this feature? Looks like there might have been a related issue already: #242 ?

I would love to get this doc inheritance.

Read more comments on GitHub >

github_iconTop Results From Across the Web

@inheritdoc does not properly inherit the documentation from ...
In Addition, we have a factory class FooFactory, that implements the interface IFooFactory. The factory method createIFoo() creates an instance of IFoo. Example....
Read more >
Options - Compodoc
-d, --output [folder], Where to store the generated documentation ... --hideGenerator, Do not print the Compodoc logo at the bottom of the page....
Read more >
Interceptors | NestJS - A progressive Node.js framework
An interceptor is a class annotated with the @Injectable() decorator and implements the NestInterceptor interface. Interceptors have a set of useful ...
Read more >
Ceph Dashboard Developer Documentation
These documents then form the basis of implementation scope and permit wider participation in the evolution of the Ceph Dashboard UI. Design Documents:....
Read more >
API with NestJS #57. Composing classes with the mixin pattern
Some programming languages implement multiple inheritance where a class can inherit from more than one parent class. Unfortunately, neither ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found