Don't define functions in the prototype
If `VOID` is used, TypeScript is not able to figure out what the function parameters are.
Before:
```
$ npx tsc | wc -l
1188
```
After:
```
$ npx tsc | wc -l
1169
```
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
*/
|
||||
import BaseObject from '../Object.js';
|
||||
import {createEmpty, getHeight, returnOrUpdate} from '../extent.js';
|
||||
import {FALSE} from '../functions.js';
|
||||
import {transform2D} from '../geom/flat/transform.js';
|
||||
import {get as getProjection, getTransform} from '../proj.js';
|
||||
import Units from '../proj/Units.js';
|
||||
@@ -82,6 +81,15 @@ class Geometry extends BaseObject {
|
||||
*/
|
||||
closestPointXY(x, y, closestPoint, minSquaredDistance) {}
|
||||
|
||||
/**
|
||||
* @param {number} x X.
|
||||
* @param {number} y Y.
|
||||
* @return {boolean} Contains (x, y).
|
||||
*/
|
||||
containsXY(x, y) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the closest point of the geometry to the passed point as
|
||||
* {@link module:ol/coordinate~Coordinate coordinate}.
|
||||
@@ -248,12 +256,4 @@ class Geometry extends BaseObject {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} x X.
|
||||
* @param {number} y Y.
|
||||
* @return {boolean} Contains (x, y).
|
||||
*/
|
||||
Geometry.prototype.containsXY = FALSE;
|
||||
|
||||
|
||||
export default Geometry;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/**
|
||||
* @module ol/render/Feature
|
||||
*/
|
||||
import {VOID} from '../functions.js';
|
||||
import {extend} from '../array.js';
|
||||
import {createOrUpdateFromCoordinate, createOrUpdateFromFlatCoordinates, getCenter, getHeight} from '../extent.js';
|
||||
import GeometryType from '../geom/GeometryType.js';
|
||||
@@ -208,6 +207,13 @@ class RenderFeature {
|
||||
return 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {undefined}
|
||||
*/
|
||||
getStyleFunction() {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type of this feature's geometry.
|
||||
* @return {import("../geom/GeometryType.js").default} Geometry type.
|
||||
@@ -263,10 +269,4 @@ RenderFeature.prototype.getSimplifiedGeometry =
|
||||
RenderFeature.prototype.getGeometry;
|
||||
|
||||
|
||||
/**
|
||||
* @return {undefined}
|
||||
*/
|
||||
RenderFeature.prototype.getStyleFunction = VOID;
|
||||
|
||||
|
||||
export default RenderFeature;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
* @module ol/render/canvas/Replay
|
||||
*/
|
||||
import {getUid} from '../../util.js';
|
||||
import {VOID} from '../../functions.js';
|
||||
import {equals, reverseSubArray} from '../../array.js';
|
||||
import {asColorLike} from '../../colorlike.js';
|
||||
import {buffer, clone, coordinateRelationship, createEmpty, createOrUpdate,
|
||||
@@ -456,6 +455,11 @@ class CanvasReplay extends VectorContext {
|
||||
this.hitDetectionInstructions.push(this.beginGeometryInstruction2_);
|
||||
}
|
||||
|
||||
/**
|
||||
* FIXME empty description for jsdoc
|
||||
*/
|
||||
finish() {}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {CanvasRenderingContext2D} context Context.
|
||||
@@ -1081,10 +1085,4 @@ class CanvasReplay extends VectorContext {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* FIXME empty description for jsdoc
|
||||
*/
|
||||
CanvasReplay.prototype.finish = VOID;
|
||||
|
||||
|
||||
export default CanvasReplay;
|
||||
|
||||
@@ -7,7 +7,6 @@ import Observable from '../Observable.js';
|
||||
import TileState from '../TileState.js';
|
||||
import {listen} from '../events.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import {FALSE, VOID} from '../functions.js';
|
||||
import SourceState from '../source/State.js';
|
||||
|
||||
class LayerRenderer extends Observable {
|
||||
@@ -55,6 +54,18 @@ class LayerRenderer extends Observable {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
||||
* @param {import("../PluggableMap.js").FrameState} frameState Frame state.
|
||||
* @param {number} hitTolerance Hit tolerance in pixels.
|
||||
* @param {function(this: S, (import("../Feature.js").default|import("../render/Feature.js").default), import("../layer/Layer.js").default): T} callback Feature callback.
|
||||
* @param {S} thisArg Value to use as `this` when executing `callback`.
|
||||
* @return {T|void} Callback result.
|
||||
* @template S,T
|
||||
*/
|
||||
forEachFeatureAtCoordinate(coordinate, frameState, hitTolerance, callback) {}
|
||||
|
||||
/**
|
||||
* @return {import("../layer/Layer.js").default} Layer.
|
||||
*/
|
||||
@@ -74,6 +85,15 @@ class LayerRenderer extends Observable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
||||
* @param {import("../PluggableMap.js").FrameState} frameState Frame state.
|
||||
* @return {boolean} Is there a feature at the given coordinate?
|
||||
*/
|
||||
hasFeatureAtCoordinate(coordinate, frameState) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the image if not already loaded, and register the image change
|
||||
* listener if needed.
|
||||
@@ -218,25 +238,4 @@ class LayerRenderer extends Observable {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
||||
* @param {import("../PluggableMap.js").FrameState} frameState Frame state.
|
||||
* @param {number} hitTolerance Hit tolerance in pixels.
|
||||
* @param {function(this: S, (import("../Feature.js").default|import("../render/Feature.js").default), import("../layer/Layer.js").default): T} callback Feature callback.
|
||||
* @param {S} thisArg Value to use as `this` when executing `callback`.
|
||||
* @return {T|void} Callback result.
|
||||
* @template S,T
|
||||
*/
|
||||
LayerRenderer.prototype.forEachFeatureAtCoordinate = VOID;
|
||||
|
||||
|
||||
/**
|
||||
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
||||
* @param {import("../PluggableMap.js").FrameState} frameState Frame state.
|
||||
* @return {boolean} Is there a feature at the given coordinate?
|
||||
*/
|
||||
LayerRenderer.prototype.hasFeatureAtCoordinate = FALSE;
|
||||
|
||||
|
||||
export default LayerRenderer;
|
||||
|
||||
@@ -6,7 +6,7 @@ import Disposable from '../Disposable.js';
|
||||
import {listen, unlistenByKey} from '../events.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import {getWidth} from '../extent.js';
|
||||
import {TRUE, VOID} from '../functions.js';
|
||||
import {TRUE} from '../functions.js';
|
||||
import {visibleAtResolution} from '../layer/Layer.js';
|
||||
import {shared as iconImageCache} from '../style/IconImageCache.js';
|
||||
import {compose as composeTransform, invert as invertTransform, setFromArray as transformSetFromArray} from '../transform.js';
|
||||
@@ -46,6 +46,13 @@ class MapRenderer extends Disposable {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
* @param {import("../render/EventType.js").default} type Event type.
|
||||
* @param {import("../PluggableMap.js").FrameState} frameState Frame state.
|
||||
*/
|
||||
dispatchRenderEvent(type, frameState) {}
|
||||
|
||||
/**
|
||||
* Register layer renderer constructors.
|
||||
* @param {Array<import("./Layer.js").default>} constructors Layer renderers.
|
||||
@@ -283,6 +290,13 @@ class MapRenderer extends Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
* Render.
|
||||
* @param {?import("../PluggableMap.js").FrameState} frameState Frame state.
|
||||
*/
|
||||
renderFrame(frameState) {}
|
||||
|
||||
/**
|
||||
* @param {import("../PluggableMap.js").FrameState} frameState Frame state.
|
||||
* @protected
|
||||
@@ -317,20 +331,6 @@ function expireIconCache(map, frameState) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render.
|
||||
* @param {?import("../PluggableMap.js").FrameState} frameState Frame state.
|
||||
*/
|
||||
MapRenderer.prototype.renderFrame = VOID;
|
||||
|
||||
|
||||
/**
|
||||
* @param {import("../render/EventType.js").default} type Event type.
|
||||
* @param {import("../PluggableMap.js").FrameState} frameState Frame state.
|
||||
*/
|
||||
MapRenderer.prototype.dispatchRenderEvent = VOID;
|
||||
|
||||
|
||||
/**
|
||||
* @param {import("../layer/Layer.js").State} state1 First layer state.
|
||||
* @param {import("../layer/Layer.js").State} state2 Second layer state.
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
* @module ol/source/Tile
|
||||
*/
|
||||
|
||||
import {VOID} from '../functions.js';
|
||||
import TileCache from '../TileCache.js';
|
||||
import TileState from '../TileState.js';
|
||||
import Event from '../events/Event.js';
|
||||
@@ -291,19 +290,20 @@ class TileSource extends Source {
|
||||
this.tileCache.clear();
|
||||
this.changed();
|
||||
}
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
* Marks a tile coord as being used, without triggering a load.
|
||||
* @param {number} z Tile coordinate z.
|
||||
* @param {number} x Tile coordinate x.
|
||||
* @param {number} y Tile coordinate y.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
*/
|
||||
useTile(z, x, y, projection) {}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Marks a tile coord as being used, without triggering a load.
|
||||
* @param {number} z Tile coordinate z.
|
||||
* @param {number} x Tile coordinate x.
|
||||
* @param {number} y Tile coordinate y.
|
||||
* @param {import("../proj/Projection.js").default} projection Projection.
|
||||
*/
|
||||
TileSource.prototype.useTile = VOID;
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Events emitted by {@link module:ol/source/Tile~TileSource} instances are instances of this
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/**
|
||||
* @module ol/webgl/Shader
|
||||
*/
|
||||
import {FALSE} from '../functions.js';
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
@@ -21,6 +20,13 @@ class WebGLShader {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {boolean} Is animated?
|
||||
*/
|
||||
isAnimated() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
* @return {number} Type.
|
||||
@@ -36,8 +42,4 @@ class WebGLShader {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} Is animated?
|
||||
*/
|
||||
WebGLShader.prototype.isAnimated = FALSE;
|
||||
export default WebGLShader;
|
||||
|
||||
Reference in New Issue
Block a user