Angular-cli: warning TS0: @interface annotations are redundant with TypeScript equivalents

Created on 17 Jun 2018  路  7Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [x] bug report

Versions


NPM 5.6.0
NodeJS v10.1.0

Repro steps

  • ng generate library dd-ng-primitives --prefix=dd
  • add interfaces with JSDoc. Sample:
/**
 * Container size.
 * @export
 * @interface Size
 */
export interface Size {
  /**
   * Container width into pixels.
   * @type {number}
   * @memberof Size
   */
  width: number;

  /**
   * Container height into pixels.
   * @type {number}
   * @memberof Size
   */
  height: number;
}

-- ng build --prod dd-ng-virtualized

The log given by the failure

BUILD ERROR
projects/dd-ng-primitives/src/lib/resize-notifier/size.ts(1,1): warning TS0: @interface annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/size.ts(7,3): warning TS0: @type annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/size.ts(14,3): warning TS0: @type annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/resize-notifier.component.ts(7,1): warning TS0: @class annotations are redundant with TypeScript equivalents
@implements annotations are redundant with TypeScript equivalents
@implements annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/resize-notifier.component.ts(22,3): warning TS0: @type annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/resize-notifier.component.ts(44,3): warning TS0: @type annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/resize-notifier.component.ts(22,3): warning TS0: @type annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/resize-notifier.component.ts(44,3): warning TS0: @type annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/dd-ng-primitives.module.ts(6,1): warning TS0: @class annotations are redundant with TypeScript equivalents

Error: projects/dd-ng-primitives/src/lib/resize-notifier/size.ts(1,1): warning TS0: @interface annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/size.ts(7,3): warning TS0: @type annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/size.ts(14,3): warning TS0: @type annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/resize-notifier.component.ts(7,1): warning TS0: @class annotations are redundant with TypeScript equivalents
@implements annotations are redundant with TypeScript equivalents
@implements annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/resize-notifier.component.ts(22,3): warning TS0: @type annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/resize-notifier.component.ts(44,3): warning TS0: @type annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/resize-notifier.component.ts(22,3): warning TS0: @type annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/resize-notifier.component.ts(44,3): warning TS0: @type annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/dd-ng-primitives.module.ts(6,1): warning TS0: @class annotations are redundant with TypeScript equivalents

at Object.<anonymous> (C:\PROJECTS\dd-ng-primitives\node_modules\ng-packagr\lib\ngc\compile-source-files.js:53:68)
at Generator.next (<anonymous>)
at C:\PROJECTS\dd-ng-primitives\node_modules\ng-packagr\lib\ngc\compile-source-files.js:7:71
at new Promise (<anonymous>)
at __awaiter (C:\PROJECTS\dd-ng-primitives\node_modules\ng-packagr\lib\ngc\compile-source-files.js:3:12)
at Object.compileSourceFiles (C:\PROJECTS\dd-ng-primitives\node_modules\ng-packagr\lib\ngc\compile-source-files.js:19:12)
at Object.<anonymous> (C:\PROJECTS\dd-ng-primitives\node_modules\ng-packagr\lib\ng-v5\entry-point\ts\compile-ngc.transform.js:31:32)
at Generator.next (<anonymous>)
at C:\PROJECTS\dd-ng-primitives\node_modules\ng-packagr\lib\ng-v5\entry-point\ts\compile-ngc.transform.js:7:71
at new Promise (<anonymous>)

projects/dd-ng-primitives/src/lib/resize-notifier/size.ts(1,1): warning TS0: @interface annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/size.ts(7,3): warning TS0: @type annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/size.ts(14,3): warning TS0: @type annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/resize-notifier.component.ts(7,1): warning TS0: @class annotations are redundant with TypeScript equivalents
@implements annotations are redundant with TypeScript equivalents
@implements annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/resize-notifier.component.ts(22,3): warning TS0: @type annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/resize-notifier.component.ts(44,3): warning TS0: @type annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/resize-notifier.component.ts(22,3): warning TS0: @type annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/resize-notifier.component.ts(44,3): warning TS0: @type annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/dd-ng-primitives.module.ts(6,1): warning TS0: @class annotations are redundant with TypeScript equivalents

Error: projects/dd-ng-primitives/src/lib/resize-notifier/size.ts(1,1): warning TS0: @interface annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/size.ts(7,3): warning TS0: @type annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/size.ts(14,3): warning TS0: @type annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/resize-notifier.component.ts(7,1): warning TS0: @class annotations are redundant with TypeScript equivalents
@implements annotations are redundant with TypeScript equivalents
@implements annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/resize-notifier.component.ts(22,3): warning TS0: @type annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/resize-notifier.component.ts(44,3): warning TS0: @type annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/resize-notifier.component.ts(22,3): warning TS0: @type annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/resize-notifier/resize-notifier.component.ts(44,3): warning TS0: @type annotations are redundant with TypeScript equivalents
projects/dd-ng-primitives/src/lib/dd-ng-primitives.module.ts(6,1): warning TS0: @class annotations are redundant with TypeScript equivalents

at Object.<anonymous> (C:\PROJECTS\dd-ng-primitives\node_modules\ng-packagr\lib\ngc\compile-source-files.js:53:68)
at Generator.next (<anonymous>)
at C:\PROJECTS\dd-ng-primitives\node_modules\ng-packagr\lib\ngc\compile-source-files.js:7:71
at new Promise (<anonymous>)
at __awaiter (C:\PROJECTS\dd-ng-primitives\node_modules\ng-packagr\lib\ngc\compile-source-files.js:3:12)
at Object.compileSourceFiles (C:\PROJECTS\dd-ng-primitives\node_modules\ng-packagr\lib\ngc\compile-source-files.js:19:12)
at Object.<anonymous> (C:\PROJECTS\dd-ng-primitives\node_modules\ng-packagr\lib\ng-v5\entry-point\ts\compile-ngc.transform.js:31:32)
at Generator.next (<anonymous>)
at C:\PROJECTS\dd-ng-primitives\node_modules\ng-packagr\lib\ng-v5\entry-point\ts\compile-ngc.transform.js:7:71
at new Promise (<anonymous>)

Desired functionality

Library builded without errors.

Mention any other details that might be useful

repo: https://github.com/derkachdeveloper/dd-ng-primitives

Most helpful comment

My solution, in angular 7, was change my tsconfig.lib.json config,

from this:

"angularCompilerOptions": {
    "annotateForClosureCompiler": true
    ...
    ...
}

to this:

"angularCompilerOptions": {
    "annotateForClosureCompiler": false
    ...
    ...
}

All 7 comments

Hi, those JSDocs are redundant and should be removed in order to get your library working.

Redundant JSDocs will cause the build to fail.

@alan-agius4, it is will be to work for a follow releases?

@derkachdeveloper, I am not sure if I understand what you meant above. but, if you meant, if this is a bug that will be solved in the future. I don't know, it's a tsickle https://github.com/angular/tsickle/blob/d24b139b71a3f86bf25d6eecf4d4dcdad3b379e4/src/jsdoc.ts#L170-L178, and redundant JSDocs needs to be removed in order to get your build working.

I suggest you enable the no-redundant-jsdoc tslint rule. https://palantir.github.io/tslint/rules/no-redundant-jsdoc/

@alan-agius4 , thank you. Close issue.

My solution, in angular 7, was change my tsconfig.lib.json config,

from this:

"angularCompilerOptions": {
    "annotateForClosureCompiler": true
    ...
    ...
}

to this:

"angularCompilerOptions": {
    "annotateForClosureCompiler": false
    ...
    ...
}

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings