Skip to content

Files

Latest commit

 

History

History
33 lines (26 loc) · 561 Bytes

implements-on-classes.md

File metadata and controls

33 lines (26 loc) · 561 Bytes

Pattern: Implements on non-constructor

Issue: -

Description

The @implements tag should only be used on class constructors or functions marked with @class. Using it on regular functions is incorrect as they cannot implement interfaces.

Examples

Example of incorrect code:

/**
 * @implements {Interface}
 */
function normalFunction() {}

Example of correct code:

/**
 * @implements {Interface}
 */
class MyClass {
  constructor() {}
}

/**
 * @implements {Interface}
 * @class
 */
function ClassFunction() {}