google / google/closure-compiler
Documentation of interfaces lacks examples of ES6 syntax
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
ES6 or ESNext is very popular nowadays, it would be nice to add some examples to the documentation of interfaces on how to use them with ES6 class syntax.
The documentation of interfaces can be found roughly here:
1. [all types](https://github.com/google/closure-compiler/wiki/Types-in-the-Closure-Type-System)
2. [special chapter](https://github.com/google/closure-compiler/wiki/Structural-Interfaces-in-Closure-Compiler#nominal-interfaces)
Somewhere in there, it would be nice to have a usage example along the lines of:
```js
/**
* @interface
*/
class ISerializable {
constructor() {
/** @type {string} */
this.id;
}
/**
* @returns {string}
*/
serialize() {}
}
/**
* @implements {ISerializable}
*/
class Car {
constructor() {
this.id = 'FJS904328JS';
}
serialize() {
return '{ "id": "FJS904328JS"}'
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.