Transformed types

Using the [ts.js codemod](https://gist.github.com/tschaub/1ea498c9d1e5268cf36d212b3949be4e):

    jscodeshift --transform ts.js src
This commit is contained in:
Tim Schaub
2018-09-05 08:05:29 -06:00
parent f2aaaa19e1
commit ccfacc5ee6
239 changed files with 3999 additions and 3999 deletions

View File

@@ -28,7 +28,7 @@ import {visibleAtResolution} from '../layer/Layer.js';
* @property {string|HTMLElement} [collapseLabel='»'] Text label to use
* for the expanded attributions button.
* Instead of text, also an element (e.g. a `span` element) can be used.
* @property {function(module:ol/MapEvent)} [render] Function called when
* @property {function(import("../MapEvent.js").default)} [render] Function called when
* the control should be re-rendered. This is called in a `requestAnimationFrame`
* callback.
*/
@@ -46,7 +46,7 @@ import {visibleAtResolution} from '../layer/Layer.js';
class Attribution extends Control {
/**
* @param {module:ol/control/Attribution~Options=} opt_options Attribution options.
* @param {Options=} opt_options Attribution options.
*/
constructor(opt_options) {
@@ -146,7 +146,7 @@ class Attribution extends Control {
/**
* Get a list of visible attributions.
* @param {module:ol/PluggableMap~FrameState} frameState Frame state.
* @param {import("../PluggableMap.js").FrameState} frameState Frame state.
* @return {Array<string>} Attributions.
* @private
*/
@@ -205,7 +205,7 @@ class Attribution extends Control {
/**
* @private
* @param {?module:ol/PluggableMap~FrameState} frameState Frame state.
* @param {?import("../PluggableMap.js").FrameState} frameState Frame state.
*/
updateElement_(frameState) {
if (!frameState) {
@@ -315,8 +315,8 @@ class Attribution extends Control {
/**
* Update the attribution element.
* @param {module:ol/MapEvent} mapEvent Map event.
* @this {module:ol/control/Attribution}
* @param {import("../MapEvent.js").default} mapEvent Map event.
* @this {import("./Attribution.js").default}
* @api
*/
export function render(mapEvent) {

View File

@@ -13,7 +13,7 @@ import {listen, unlistenByKey} from '../events.js';
* @property {HTMLElement} [element] The element is the control's
* container element. This only needs to be specified if you're developing
* a custom control.
* @property {function(module:ol/MapEvent)} [render] Function called when
* @property {function(import("../MapEvent.js").default)} [render] Function called when
* the control should be re-rendered. This is called in a `requestAnimationFrame`
* callback.
* @property {HTMLElement|string} [target] Specify a target if you want
@@ -48,7 +48,7 @@ import {listen, unlistenByKey} from '../events.js';
class Control extends BaseObject {
/**
* @param {module:ol/control/Control~Options} options Control options.
* @param {Options} options Control options.
*/
constructor(options) {
@@ -68,18 +68,18 @@ class Control extends BaseObject {
/**
* @private
* @type {module:ol/PluggableMap}
* @type {import("../PluggableMap.js").default}
*/
this.map_ = null;
/**
* @protected
* @type {!Array<module:ol/events~EventsKey>}
* @type {!Array<import("../events.js").EventsKey>}
*/
this.listenerKeys = [];
/**
* @type {function(module:ol/MapEvent)}
* @type {function(import("../MapEvent.js").default)}
*/
this.render = options.render ? options.render : VOID;
@@ -99,7 +99,7 @@ class Control extends BaseObject {
/**
* Get the map associated with this control.
* @return {module:ol/PluggableMap} Map.
* @return {import("../PluggableMap.js").default} Map.
* @api
*/
getMap() {
@@ -110,7 +110,7 @@ class Control extends BaseObject {
* Remove the control from its current map and attach it to the new map.
* Subclasses may set up event handlers to get notified about changes to
* the map here.
* @param {module:ol/PluggableMap} map Map.
* @param {import("../PluggableMap.js").default} map Map.
* @api
*/
setMap(map) {

View File

@@ -65,7 +65,7 @@ const getChangeType = (function() {
class FullScreen extends Control {
/**
* @param {module:ol/control/FullScreen~Options=} opt_options Options.
* @param {Options=} opt_options Options.
*/
constructor(opt_options) {

View File

@@ -22,9 +22,9 @@ const COORDINATE_FORMAT = 'coordinateFormat';
/**
* @typedef {Object} Options
* @property {string} [className='ol-mouse-position'] CSS class name.
* @property {module:ol/coordinate~CoordinateFormat} [coordinateFormat] Coordinate format.
* @property {module:ol/proj~ProjectionLike} projection Projection.
* @property {function(module:ol/MapEvent)} [render] Function called when the
* @property {import("../coordinate.js").CoordinateFormat} [coordinateFormat] Coordinate format.
* @property {import("../proj.js").ProjectionLike} projection Projection.
* @property {function(import("../MapEvent.js").default)} [render] Function called when the
* control should be re-rendered. This is called in a `requestAnimationFrame`
* callback.
* @property {Element|string} [target] Specify a target if you want the
@@ -49,7 +49,7 @@ const COORDINATE_FORMAT = 'coordinateFormat';
class MousePosition extends Control {
/**
* @param {module:ol/control/MousePosition~Options=} opt_options Mouse position options.
* @param {Options=} opt_options Mouse position options.
*/
constructor(opt_options) {
@@ -95,19 +95,19 @@ class MousePosition extends Control {
/**
* @private
* @type {module:ol/proj/Projection}
* @type {import("../proj/Projection.js").default}
*/
this.mapProjection_ = null;
/**
* @private
* @type {?module:ol/proj~TransformFunction}
* @type {?import("../proj.js").TransformFunction}
*/
this.transform_ = null;
/**
* @private
* @type {module:ol/pixel~Pixel}
* @type {import("../pixel.js").Pixel}
*/
this.lastMouseMovePixel_ = null;
@@ -123,27 +123,27 @@ class MousePosition extends Control {
/**
* Return the coordinate format type used to render the current position or
* undefined.
* @return {module:ol/coordinate~CoordinateFormat|undefined} The format to render the current
* @return {import("../coordinate.js").CoordinateFormat|undefined} The format to render the current
* position in.
* @observable
* @api
*/
getCoordinateFormat() {
return (
/** @type {module:ol/coordinate~CoordinateFormat|undefined} */ (this.get(COORDINATE_FORMAT))
/** @type {import("../coordinate.js").CoordinateFormat|undefined} */ (this.get(COORDINATE_FORMAT))
);
}
/**
* Return the projection that is used to report the mouse position.
* @return {module:ol/proj/Projection|undefined} The projection to report mouse
* @return {import("../proj/Projection.js").default|undefined} The projection to report mouse
* position in.
* @observable
* @api
*/
getProjection() {
return (
/** @type {module:ol/proj/Projection|undefined} */ (this.get(PROJECTION))
/** @type {import("../proj/Projection.js").default|undefined} */ (this.get(PROJECTION))
);
}
@@ -187,7 +187,7 @@ class MousePosition extends Control {
/**
* Set the coordinate format type used to render the current position.
* @param {module:ol/coordinate~CoordinateFormat} format The format to render the current
* @param {import("../coordinate.js").CoordinateFormat} format The format to render the current
* position in.
* @observable
* @api
@@ -198,7 +198,7 @@ class MousePosition extends Control {
/**
* Set the projection that is used to report the mouse position.
* @param {module:ol/proj~ProjectionLike} projection The projection to report mouse
* @param {import("../proj.js").ProjectionLike} projection The projection to report mouse
* position in.
* @observable
* @api
@@ -208,7 +208,7 @@ class MousePosition extends Control {
}
/**
* @param {?module:ol/pixel~Pixel} pixel Pixel.
* @param {?import("../pixel.js").Pixel} pixel Pixel.
* @private
*/
updateHTML_(pixel) {
@@ -245,8 +245,8 @@ class MousePosition extends Control {
/**
* Update the mouseposition element.
* @param {module:ol/MapEvent} mapEvent Map event.
* @this {module:ol/control/MousePosition}
* @param {import("../MapEvent.js").default} mapEvent Map event.
* @this {import("./MousePosition.js").default}
* @api
*/
export function render(mapEvent) {

View File

@@ -44,15 +44,15 @@ const MIN_RATIO = 0.1;
* @property {boolean} [collapsible=true] Whether the control can be collapsed or not.
* @property {string|HTMLElement} [label='»'] Text label to use for the collapsed
* overviewmap button. Instead of text, also an element (e.g. a `span` element) can be used.
* @property {Array<module:ol/layer/Layer>|module:ol/Collection<module:ol/layer/Layer>} [layers]
* @property {Array<import("../layer/Layer.js").default>|import("../Collection.js").default<import("../layer/Layer.js").default>} [layers]
* Layers for the overview map. If not set, then all main map layers are used
* instead.
* @property {function(module:ol/MapEvent)} [render] Function called when the control
* @property {function(import("../MapEvent.js").default)} [render] Function called when the control
* should be re-rendered. This is called in a `requestAnimationFrame` callback.
* @property {HTMLElement|string} [target] Specify a target if you want the control
* to be rendered outside of the map's viewport.
* @property {string} [tipLabel='Overview map'] Text label to use for the button tip.
* @property {module:ol/View} [view] Custom view for the overview map. If not provided,
* @property {import("../View.js").default} [view] Custom view for the overview map. If not provided,
* a default view with an EPSG:3857 projection will be used.
*/
@@ -66,7 +66,7 @@ const MIN_RATIO = 0.1;
class OverviewMap extends Control {
/**
* @param {module:ol/control/OverviewMap~Options=} opt_options OverviewMap options.
* @param {Options=} opt_options OverviewMap options.
*/
constructor(opt_options) {
@@ -144,7 +144,7 @@ class OverviewMap extends Control {
this.ovmapDiv_.className = 'ol-overviewmap-map';
/**
* @type {module:ol/Map}
* @type {import("../Map.js").default}
* @private
*/
this.ovmap_ = new Map({
@@ -157,7 +157,7 @@ class OverviewMap extends Control {
if (options.layers) {
options.layers.forEach(
/**
* @param {module:ol/layer/Layer} layer Layer.
* @param {import("../layer/Layer.js").default} layer Layer.
*/
(function(layer) {
ovmap.addLayer(layer);
@@ -169,7 +169,7 @@ class OverviewMap extends Control {
box.style.boxSizing = 'border-box';
/**
* @type {module:ol/Overlay}
* @type {import("../Overlay.js").default}
* @private
*/
this.boxOverlay_ = new Overlay({
@@ -268,12 +268,12 @@ class OverviewMap extends Control {
/**
* Handle map property changes. This only deals with changes to the map's view.
* @param {module:ol/Object~ObjectEvent} event The propertychange event.
* @param {import("../Object.js").ObjectEvent} event The propertychange event.
* @private
*/
handleMapPropertyChange_(event) {
if (event.key === MapProperty.VIEW) {
const oldView = /** @type {module:ol/View} */ (event.oldValue);
const oldView = /** @type {import("../View.js").default} */ (event.oldValue);
if (oldView) {
this.unbindView_(oldView);
}
@@ -284,7 +284,7 @@ class OverviewMap extends Control {
/**
* Register listeners for view property changes.
* @param {module:ol/View} view The view.
* @param {import("../View.js").default} view The view.
* @private
*/
bindView_(view) {
@@ -295,7 +295,7 @@ class OverviewMap extends Control {
/**
* Unregister listeners for view property changes.
* @param {module:ol/View} view The view.
* @param {import("../View.js").default} view The view.
* @private
*/
unbindView_(view) {
@@ -333,12 +333,12 @@ class OverviewMap extends Control {
return;
}
const mapSize = /** @type {module:ol/size~Size} */ (map.getSize());
const mapSize = /** @type {import("../size.js").Size} */ (map.getSize());
const view = map.getView();
const extent = view.calculateExtent(mapSize);
const ovmapSize = /** @type {module:ol/size~Size} */ (ovmap.getSize());
const ovmapSize = /** @type {import("../size.js").Size} */ (ovmap.getSize());
const ovview = ovmap.getView();
const ovextent = ovview.calculateExtent(ovmapSize);
@@ -377,7 +377,7 @@ class OverviewMap extends Control {
const map = this.getMap();
const ovmap = this.ovmap_;
const mapSize = /** @type {module:ol/size~Size} */ (map.getSize());
const mapSize = /** @type {import("../size.js").Size} */ (map.getSize());
const view = map.getView();
const extent = view.calculateExtent(mapSize);
@@ -422,7 +422,7 @@ class OverviewMap extends Control {
return;
}
const mapSize = /** @type {module:ol/size~Size} */ (map.getSize());
const mapSize = /** @type {import("../size.js").Size} */ (map.getSize());
const view = map.getView();
@@ -450,8 +450,8 @@ class OverviewMap extends Control {
/**
* @param {number} rotation Target rotation.
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
* @return {module:ol/coordinate~Coordinate|undefined} Coordinate for rotation and center anchor.
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
* @return {import("../coordinate.js").Coordinate|undefined} Coordinate for rotation and center anchor.
* @private
*/
calculateCoordinateRotate_(rotation, coordinate) {
@@ -558,7 +558,7 @@ class OverviewMap extends Control {
/**
* Return the overview map.
* @return {module:ol/PluggableMap} Overview map.
* @return {import("../PluggableMap.js").default} Overview map.
* @api
*/
getOverviewMap() {
@@ -569,8 +569,8 @@ class OverviewMap extends Control {
/**
* Update the overview map element.
* @param {module:ol/MapEvent} mapEvent Map event.
* @this {module:ol/control/OverviewMap}
* @param {import("../MapEvent.js").default} mapEvent Map event.
* @this {import("./OverviewMap.js").default}
* @api
*/
export function render(mapEvent) {

View File

@@ -16,7 +16,7 @@ import EventType from '../events/EventType.js';
* @property {string} [tipLabel='Reset rotation'] Text label to use for the rotate tip.
* @property {number} [duration=250] Animation duration in milliseconds.
* @property {boolean} [autoHide=true] Hide the control when rotation is 0.
* @property {function(module:ol/MapEvent)} [render] Function called when the control should
* @property {function(import("../MapEvent.js").default)} [render] Function called when the control should
* be re-rendered. This is called in a `requestAnimationFrame` callback.
* @property {function()} [resetNorth] Function called when the control is clicked.
* This will override the default `resetNorth`.
@@ -36,7 +36,7 @@ import EventType from '../events/EventType.js';
class Rotate extends Control {
/**
* @param {module:ol/control/Rotate~Options=} opt_options Rotate options.
* @param {Options=} opt_options Rotate options.
*/
constructor(opt_options) {
@@ -149,8 +149,8 @@ class Rotate extends Control {
/**
* Update the rotate control element.
* @param {module:ol/MapEvent} mapEvent Map event.
* @this {module:ol/control/Rotate}
* @param {import("../MapEvent.js").default} mapEvent Map event.
* @this {import("./Rotate.js").default}
* @api
*/
export function render(mapEvent) {

View File

@@ -40,11 +40,11 @@ const LEADING_DIGITS = [1, 2, 5];
* @typedef {Object} Options
* @property {string} [className='ol-scale-line'] CSS Class name.
* @property {number} [minWidth=64] Minimum width in pixels.
* @property {function(module:ol/MapEvent)} [render] Function called when the control
* @property {function(import("../MapEvent.js").default)} [render] Function called when the control
* should be re-rendered. This is called in a `requestAnimationFrame` callback.
* @property {HTMLElement|string} [target] Specify a target if you want the control
* to be rendered outside of the map's viewport.
* @property {module:ol/control/ScaleLine~Units|string} [units='metric'] Units.
* @property {Units|string} [units='metric'] Units.
*/
@@ -63,7 +63,7 @@ const LEADING_DIGITS = [1, 2, 5];
class ScaleLine extends Control {
/**
* @param {module:ol/control/ScaleLine~Options=} opt_options Scale line options.
* @param {Options=} opt_options Scale line options.
*/
constructor(opt_options) {
@@ -89,7 +89,7 @@ class ScaleLine extends Control {
/**
* @private
* @type {?module:ol/View~State}
* @type {?import("../View.js").State}
*/
this.viewState_ = null;
@@ -121,21 +121,21 @@ class ScaleLine extends Control {
this, getChangeEventType(UNITS_PROP),
this.handleUnitsChanged_, this);
this.setUnits(/** @type {module:ol/control/ScaleLine~Units} */ (options.units) ||
this.setUnits(/** @type {Units} */ (options.units) ||
Units.METRIC);
}
/**
* Return the units to use in the scale line.
* @return {module:ol/control/ScaleLine~Units|undefined} The units
* @return {Units|undefined} The units
* to use in the scale line.
* @observable
* @api
*/
getUnits() {
return (
/** @type {module:ol/control/ScaleLine~Units|undefined} */ (this.get(UNITS_PROP))
/** @type {Units|undefined} */ (this.get(UNITS_PROP))
);
}
@@ -148,7 +148,7 @@ class ScaleLine extends Control {
/**
* Set the units to use in the scale line.
* @param {module:ol/control/ScaleLine~Units} units The units to use in the scale line.
* @param {Units} units The units to use in the scale line.
* @observable
* @api
*/
@@ -282,8 +282,8 @@ class ScaleLine extends Control {
/**
* Update the scale line element.
* @param {module:ol/MapEvent} mapEvent Map event.
* @this {module:ol/control/ScaleLine}
* @param {import("../MapEvent.js").default} mapEvent Map event.
* @this {import("./ScaleLine.js").default}
* @api
*/
export function render(mapEvent) {

View File

@@ -35,7 +35,7 @@ import {easeOut} from '../easing.js';
class Zoom extends Control {
/**
* @param {module:ol/control/Zoom~Options=} opt_options Zoom options.
* @param {Options=} opt_options Zoom options.
*/
constructor(opt_options) {

View File

@@ -28,7 +28,7 @@ const Direction = {
* @typedef {Object} Options
* @property {string} [className='ol-zoomslider'] CSS class name.
* @property {number} [duration=200] Animation duration in milliseconds.
* @property {function(module:ol/MapEvent)} [render] Function called when the control
* @property {function(import("../MapEvent.js").default)} [render] Function called when the control
* should be re-rendered. This is called in a `requestAnimationFrame` callback.
*/
@@ -46,7 +46,7 @@ const Direction = {
class ZoomSlider extends Control {
/**
* @param {module:ol/control/ZoomSlider~Options=} opt_options Zoom slider options.
* @param {Options=} opt_options Zoom slider options.
*/
constructor(opt_options) {
@@ -107,7 +107,7 @@ class ZoomSlider extends Control {
/**
* The calculated thumb size (border box plus margins). Set when initSlider_
* is called.
* @type {module:ol/size~Size}
* @type {import("../size.js").Size}
* @private
*/
this.thumbSize_ = null;
@@ -133,7 +133,7 @@ class ZoomSlider extends Control {
containerElement.className = className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;
containerElement.appendChild(thumbElement);
/**
* @type {module:ol/pointer/PointerEventHandler}
* @type {import("../pointer/PointerEventHandler.js").default}
* @private
*/
this.dragger_ = new PointerEventHandler(containerElement);
@@ -222,7 +222,7 @@ class ZoomSlider extends Control {
/**
* Handle dragger start events.
* @param {module:ol/pointer/PointerEvent} event The drag event.
* @param {import("../pointer/PointerEvent.js").default} event The drag event.
* @private
*/
handleDraggerStart_(event) {
@@ -237,7 +237,7 @@ class ZoomSlider extends Control {
/**
* Handle dragger drag events.
*
* @param {module:ol/pointer/PointerEvent|Event} event The drag event.
* @param {import("../pointer/PointerEvent.js").default|Event} event The drag event.
* @private
*/
handleDraggerDrag_(event) {
@@ -256,7 +256,7 @@ class ZoomSlider extends Control {
/**
* Handle dragger end events.
* @param {module:ol/pointer/PointerEvent|Event} event The drag event.
* @param {import("../pointer/PointerEvent.js").default|Event} event The drag event.
* @private
*/
handleDraggerEnd_(event) {
@@ -344,8 +344,8 @@ class ZoomSlider extends Control {
/**
* Update the zoomslider element.
* @param {module:ol/MapEvent} mapEvent Map event.
* @this {module:ol/control/ZoomSlider}
* @param {import("../MapEvent.js").default} mapEvent Map event.
* @this {import("./ZoomSlider.js").default}
* @api
*/
export function render(mapEvent) {

View File

@@ -15,7 +15,7 @@ import {CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';
* @property {string|HTMLElement} [label='E'] Text label to use for the button.
* Instead of text, also an element (e.g. a `span` element) can be used.
* @property {string} [tipLabel='Fit to extent'] Text label to use for the button tip.
* @property {module:ol/extent~Extent} [extent] The extent to zoom to. If undefined the validity
* @property {import("../extent.js").Extent} [extent] The extent to zoom to. If undefined the validity
* extent of the view projection is used.
*/
@@ -30,7 +30,7 @@ import {CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';
class ZoomToExtent extends Control {
/**
* @param {module:ol/control/ZoomToExtent~Options=} opt_options Options.
* @param {Options=} opt_options Options.
*/
constructor(opt_options) {
const options = opt_options ? opt_options : {};
@@ -41,7 +41,7 @@ class ZoomToExtent extends Control {
});
/**
* @type {module:ol/extent~Extent}
* @type {import("../extent.js").Extent}
* @protected
*/
this.extent = options.extent ? options.extent : null;

View File

@@ -11,14 +11,14 @@ import Zoom from './Zoom.js';
* @typedef {Object} DefaultsOptions
* @property {boolean} [attribution=true] Include
* {@link module:ol/control/Attribution~Attribution}.
* @property {module:ol/control/Attribution~Options} [attributionOptions]
* @property {import("./Attribution.js").Options} [attributionOptions]
* Options for {@link module:ol/control/Attribution~Attribution}.
* @property {boolean} [rotate=true] Include
* {@link module:ol/control/Rotate~Rotate}.
* @property {module:ol/control/Rotate~Options} [rotateOptions] Options
* @property {import("./Rotate.js").Options} [rotateOptions] Options
* for {@link module:ol/control/Rotate~Rotate}.
* @property {boolean} [zoom] Include {@link module:ol/control/Zoom~Zoom}.
* @property {module:ol/control/Zoom~Options} [zoomOptions] Options for
* @property {import("./Zoom.js").Options} [zoomOptions] Options for
* {@link module:ol/control/Zoom~Zoom}.
* @api
*/
@@ -32,9 +32,9 @@ import Zoom from './Zoom.js';
* * {@link module:ol/control/Rotate~Rotate}
* * {@link module:ol/control/Attribution~Attribution}
*
* @param {module:ol/control/util~DefaultsOptions=} opt_options
* @param {DefaultsOptions=} opt_options
* Defaults options.
* @return {module:ol/Collection<module:ol/control/Control>}
* @return {import("../Collection.js").default<import("./Control.js").default>}
* Controls.
* @function module:ol/control.defaults
* @api