Fix typing errors.

This commit is contained in:
Simon Seyock
2021-08-06 11:07:24 +02:00
parent d6e0eb75fa
commit f636d68cce
4 changed files with 17 additions and 5 deletions

View File

@@ -563,7 +563,7 @@ class PluggableMap extends BaseObject {
* @param {AtPixelOptions} [opt_options] Optional options.
* @return {T|undefined} Callback result, i.e. the return value of last
* callback execution, or the first truthy callback return value.
* @template S,T
* @template T
* @api
*/
forEachFeatureAtPixel(pixel, callback, opt_options) {

View File

@@ -1882,8 +1882,12 @@ function readStyle(node, objectStack) {
const geometry = feature.getGeometry();
const type = geometry.getType();
if (type === GeometryType.GEOMETRY_COLLECTION) {
return new GeometryCollection(
const collection =
/** @type {import("../geom/GeometryCollection").default} */ (
geometry
);
return new GeometryCollection(
collection
.getGeometriesArrayRecursive()
.filter(function (geometry) {
const type = geometry.getType();
@@ -1911,8 +1915,12 @@ function readStyle(node, objectStack) {
const geometry = feature.getGeometry();
const type = geometry.getType();
if (type === GeometryType.GEOMETRY_COLLECTION) {
return new GeometryCollection(
const collection =
/** @type {import("../geom/GeometryCollection").default} */ (
geometry
);
return new GeometryCollection(
collection
.getGeometriesArrayRecursive()
.filter(function (geometry) {
const type = geometry.getType();

View File

@@ -1167,7 +1167,11 @@ class Modify extends PointerInteraction {
map.forEachFeatureAtPixel(
pixel,
(feature, layer, geometry) => {
geometry = geometry || feature.getGeometry();
geometry =
geometry ||
/** @type {import("../geom/SimpleGeometry").default} */ (
feature.getGeometry()
);
if (
geometry.getType() === GeometryType.POINT &&
includes(this.features_.getArray(), feature)

View File

@@ -175,7 +175,7 @@ class MapRenderer extends Disposable {
* @param {import("../pixel.js").Pixel} pixel Pixel.
* @param {import("../PluggableMap.js").FrameState} frameState FrameState.
* @param {number} hitTolerance Hit tolerance in pixels.
* @param {function(import("../layer/Layer.js").default<import("../source/Source".).default>, (Uint8ClampedArray|Uint8Array)): T} callback Layer
* @param {function(import("../layer/Layer.js").default<import("../source/Source").default>, (Uint8ClampedArray|Uint8Array)): T} callback Layer
* callback.
* @param {function(import("../layer/Layer.js").default<import("../source/Source").default>): boolean} layerFilter Layer filter
* function, only layers which are visible and for which this function