Transformed types
Using the [ts.js codemod](https://gist.github.com/tschaub/1ea498c9d1e5268cf36d212b3949be4e): jscodeshift --transform ts.js src
This commit is contained in:
@@ -22,7 +22,7 @@ import EventType from '../events/EventType.js';
|
||||
* 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
|
||||
* @fires import("../events/Event.js").Event
|
||||
* @template T
|
||||
*/
|
||||
class LRUCache extends EventTarget {
|
||||
@@ -47,19 +47,19 @@ class LRUCache extends EventTarget {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {!Object<string, module:ol/structs/LRUCache~Entry>}
|
||||
* @type {!Object<string, Entry>}
|
||||
*/
|
||||
this.entries_ = {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?module:ol/structs/LRUCache~Entry}
|
||||
* @type {?Entry}
|
||||
*/
|
||||
this.oldest_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?module:ol/structs/LRUCache~Entry}
|
||||
* @type {?Entry}
|
||||
*/
|
||||
this.newest_ = null;
|
||||
|
||||
@@ -96,7 +96,7 @@ class LRUCache extends EventTarget {
|
||||
|
||||
|
||||
/**
|
||||
* @param {function(this: S, T, string, module:ol/structs/LRUCache): ?} f The function
|
||||
* @param {function(this: S, T, string, import("./LRUCache.js").default): ?} f The function
|
||||
* to call for every entry from the oldest to the newer. This function takes
|
||||
* 3 arguments (the entry value, the entry key and the LRUCache object).
|
||||
* The return value is ignored.
|
||||
@@ -123,7 +123,7 @@ class LRUCache extends EventTarget {
|
||||
if (entry === this.newest_) {
|
||||
return entry.value_;
|
||||
} else if (entry === this.oldest_) {
|
||||
this.oldest_ = /** @type {module:ol/structs/LRUCache~Entry} */ (this.oldest_.newer);
|
||||
this.oldest_ = /** @type {Entry} */ (this.oldest_.newer);
|
||||
this.oldest_.older = null;
|
||||
} else {
|
||||
entry.newer.older = entry.older;
|
||||
@@ -146,12 +146,12 @@ class LRUCache extends EventTarget {
|
||||
const entry = this.entries_[key];
|
||||
assert(entry !== undefined, 15); // Tried to get a value for a key that does not exist in the cache
|
||||
if (entry === this.newest_) {
|
||||
this.newest_ = /** @type {module:ol/structs/LRUCache~Entry} */ (entry.older);
|
||||
this.newest_ = /** @type {Entry} */ (entry.older);
|
||||
if (this.newest_) {
|
||||
this.newest_.newer = null;
|
||||
}
|
||||
} else if (entry === this.oldest_) {
|
||||
this.oldest_ = /** @type {module:ol/structs/LRUCache~Entry} */ (entry.newer);
|
||||
this.oldest_ = /** @type {Entry} */ (entry.newer);
|
||||
if (this.oldest_) {
|
||||
this.oldest_.older = null;
|
||||
}
|
||||
@@ -235,7 +235,7 @@ class LRUCache extends EventTarget {
|
||||
if (entry.newer) {
|
||||
entry.newer.older = null;
|
||||
}
|
||||
this.oldest_ = /** @type {module:ol/structs/LRUCache~Entry} */ (entry.newer);
|
||||
this.oldest_ = /** @type {Entry} */ (entry.newer);
|
||||
if (!this.oldest_) {
|
||||
this.newest_ = null;
|
||||
}
|
||||
@@ -261,7 +261,7 @@ class LRUCache extends EventTarget {
|
||||
set(key, value) {
|
||||
assert(!(key in this.entries_),
|
||||
16); // Tried to set a value for a key that is used already
|
||||
const entry = /** @type {module:ol/structs/LRUCache~Entry} */ ({
|
||||
const entry = /** @type {Entry} */ ({
|
||||
key_: key,
|
||||
newer: null,
|
||||
older: this.newest_,
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
/**
|
||||
* @typedef {Object} Item
|
||||
* @property {module:ol/structs/LinkedList~Item} [prev]
|
||||
* @property {module:ol/structs/LinkedList~Item} [next]
|
||||
* @property {Item} [prev]
|
||||
* @property {Item} [next]
|
||||
* @property {?} data
|
||||
*/
|
||||
|
||||
@@ -24,19 +24,19 @@ class LinkedList {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/structs/LinkedList~Item|undefined}
|
||||
* @type {Item|undefined}
|
||||
*/
|
||||
this.first_;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/structs/LinkedList~Item|undefined}
|
||||
* @type {Item|undefined}
|
||||
*/
|
||||
this.last_;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/structs/LinkedList~Item|undefined}
|
||||
* @type {Item|undefined}
|
||||
*/
|
||||
this.head_;
|
||||
|
||||
@@ -61,7 +61,7 @@ class LinkedList {
|
||||
*/
|
||||
insertItem(data) {
|
||||
|
||||
/** @type {module:ol/structs/LinkedList~Item} */
|
||||
/** @type {Item} */
|
||||
const item = {
|
||||
prev: undefined,
|
||||
next: undefined,
|
||||
@@ -227,7 +227,7 @@ class LinkedList {
|
||||
|
||||
/**
|
||||
* Concatenates two lists.
|
||||
* @param {module:ol/structs/LinkedList} list List to merge into the current list.
|
||||
* @param {import("./LinkedList.js").default} list List to merge into the current list.
|
||||
*/
|
||||
concat(list) {
|
||||
if (list.head_) {
|
||||
|
||||
@@ -37,7 +37,7 @@ class RBush {
|
||||
* A mapping between the objects added to this rbush wrapper
|
||||
* and the objects that are actually added to the internal rbush.
|
||||
* @private
|
||||
* @type {Object<number, module:ol/structs/RBush~Entry>}
|
||||
* @type {Object<number, Entry>}
|
||||
*/
|
||||
this.items_ = {};
|
||||
|
||||
@@ -45,11 +45,11 @@ class RBush {
|
||||
|
||||
/**
|
||||
* Insert a value into the RBush.
|
||||
* @param {module:ol/extent~Extent} extent Extent.
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @param {T} value Value.
|
||||
*/
|
||||
insert(extent, value) {
|
||||
/** @type {module:ol/structs/RBush~Entry} */
|
||||
/** @type {Entry} */
|
||||
const item = {
|
||||
minX: extent[0],
|
||||
minY: extent[1],
|
||||
@@ -65,7 +65,7 @@ class RBush {
|
||||
|
||||
/**
|
||||
* Bulk-insert values into the RBush.
|
||||
* @param {Array<module:ol/extent~Extent>} extents Extents.
|
||||
* @param {Array<import("../extent.js").Extent>} extents Extents.
|
||||
* @param {Array<T>} values Values.
|
||||
*/
|
||||
load(extents, values) {
|
||||
@@ -74,7 +74,7 @@ class RBush {
|
||||
const extent = extents[i];
|
||||
const value = values[i];
|
||||
|
||||
/** @type {module:ol/structs/RBush~Entry} */
|
||||
/** @type {Entry} */
|
||||
const item = {
|
||||
minX: extent[0],
|
||||
minY: extent[1],
|
||||
@@ -107,7 +107,7 @@ class RBush {
|
||||
|
||||
/**
|
||||
* Update the extent of a value in the RBush.
|
||||
* @param {module:ol/extent~Extent} extent Extent.
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @param {T} value Value.
|
||||
*/
|
||||
update(extent, value) {
|
||||
@@ -134,11 +134,11 @@ class RBush {
|
||||
|
||||
/**
|
||||
* Return all values in the given extent.
|
||||
* @param {module:ol/extent~Extent} extent Extent.
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @return {Array<T>} All in extent.
|
||||
*/
|
||||
getInExtent(extent) {
|
||||
/** @type {module:ol/structs/RBush~Entry} */
|
||||
/** @type {Entry} */
|
||||
const bbox = {
|
||||
minX: extent[0],
|
||||
minY: extent[1],
|
||||
@@ -168,7 +168,7 @@ class RBush {
|
||||
|
||||
/**
|
||||
* Calls a callback function with each value in the provided extent.
|
||||
* @param {module:ol/extent~Extent} extent Extent.
|
||||
* @param {import("../extent.js").Extent} extent Extent.
|
||||
* @param {function(this: S, T): *} callback Callback.
|
||||
* @param {S=} opt_this The object to use as `this` in `callback`.
|
||||
* @return {*} Callback return value.
|
||||
@@ -217,8 +217,8 @@ class RBush {
|
||||
|
||||
|
||||
/**
|
||||
* @param {module:ol/extent~Extent=} opt_extent Extent.
|
||||
* @return {module:ol/extent~Extent} Extent.
|
||||
* @param {import("../extent.js").Extent=} opt_extent Extent.
|
||||
* @return {import("../extent.js").Extent} Extent.
|
||||
*/
|
||||
getExtent(opt_extent) {
|
||||
// FIXME add getExtent() to rbush
|
||||
@@ -228,7 +228,7 @@ class RBush {
|
||||
|
||||
|
||||
/**
|
||||
* @param {module:ol/structs/RBush} rbush R-Tree.
|
||||
* @param {import("./RBush.js").default} rbush R-Tree.
|
||||
*/
|
||||
concat(rbush) {
|
||||
this.rbush_.load(rbush.rbush_.all());
|
||||
|
||||
Reference in New Issue
Block a user