Move template type at the class level

This removes the TS1092 error from TypeScript: Type parameters cannot appear on a constructor declaration.
This commit is contained in:
Frederic Junod
2018-07-19 08:36:54 +02:00
parent 8f7b52f266
commit c1ffb0a2a9
4 changed files with 27 additions and 20 deletions

View File

@@ -56,6 +56,7 @@ export class CollectionEvent extends Event {
* Collection; they trigger events on the appropriate object, not on the
* Collection as a whole.
*
* @template T
* @api
*/
class Collection extends BaseObject {
@@ -63,7 +64,6 @@ class Collection extends BaseObject {
/**
* @param {Array.<T>=} opt_array Array.
* @param {module:ol/Collection~Options=} opt_options Collection options.
* @template T
*/
constructor(opt_array, opt_options) {

View File

@@ -16,15 +16,17 @@ import EventType from '../events/EventType.js';
*/
/**
* Implements a Least-Recently-Used cache where the keys do not conflict with
* Object's properties (e.g. 'hasOwnProperty' is not allowed as a key). Expiring
* items from the cache is the responsibility of the user.
*
* @fires module:ol/events/Event~Event
* @template T
*/
class LRUCache extends EventTarget {
/**
* Implements a Least-Recently-Used cache where the keys do not conflict with
* Object's properties (e.g. 'hasOwnProperty' is not allowed as a key). Expiring
* items from the cache is the responsibility of the user.
*
* @fires module:ol/events/Event~Event
* @template T
* @param {number=} opt_highWaterMark High water mark.
*/
constructor(opt_highWaterMark) {

View File

@@ -11,19 +11,22 @@ import {clear} from '../obj.js';
export const DROP = Infinity;
/**
* Priority queue.
*
* The implementation is inspired from the Closure Library's Heap class and
* Python's heapq module.
*
* @see http://closure-library.googlecode.com/svn/docs/closure_goog_structs_heap.js.source.html
* @see http://hg.python.org/cpython/file/2.7/Lib/heapq.py
*
* @template T
*/
class PriorityQueue {
/**
* Priority queue.
*
* The implementation is inspired from the Closure Library's Heap class and
* Python's heapq module.
*
* @see http://closure-library.googlecode.com/svn/docs/closure_goog_structs_heap.js.source.html
* @see http://hg.python.org/cpython/file/2.7/Lib/heapq.py
*
* @param {function(T): number} priorityFunction Priority function.
* @param {function(T): string} keyFunction Key function.
* @template T
*/
constructor(priorityFunction, keyFunction) {

View File

@@ -15,14 +15,16 @@ import {isEmpty} from '../obj.js';
* @property {Object} [value]
*/
/**
* Wrapper around the RBush by Vladimir Agafonkin.
*
* @see https://github.com/mourner/rbush
* @template T
*/
class RBush {
/**
* Wrapper around the RBush by Vladimir Agafonkin.
*
* @param {number=} opt_maxEntries Max entries.
* @see https://github.com/mourner/rbush
* @template T
*/
constructor(opt_maxEntries) {