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
+48 -48
View File
@@ -99,8 +99,8 @@ import Stroke from '../style/Stroke.js';
* {@link module:ol/style/Style} or an array of them. This way e.g. a
* vector layer can be styled.
*
* @typedef {function((module:ol/Feature|module:ol/render/Feature), number):
* (module:ol/style/Style|Array<module:ol/style/Style>)} StyleFunction
* @typedef {function((import("../Feature.js").default|import("../render/Feature.js").default), number):
* (import("./Style.js").default|Array<import("./Style.js").default>)} StyleFunction
*/
@@ -108,8 +108,8 @@ import Stroke from '../style/Stroke.js';
* A function that takes an {@link module:ol/Feature} as argument and returns an
* {@link module:ol/geom/Geometry} that will be rendered and styled for the feature.
*
* @typedef {function((module:ol/Feature|module:ol/render/Feature)):
* (module:ol/geom/Geometry|module:ol/render/Feature|undefined)} GeometryFunction
* @typedef {function((import("../Feature.js").default|import("../render/Feature.js").default)):
* (import("../geom/Geometry.js").default|import("../render/Feature.js").default|undefined)} GeometryFunction
*/
@@ -119,21 +119,21 @@ import Stroke from '../style/Stroke.js';
* 1. The pixel coordinates of the geometry in GeoJSON notation.
* 2. The {@link module:ol/render~State} of the layer renderer.
*
* @typedef {function((module:ol/coordinate~Coordinate|Array<module:ol/coordinate~Coordinate>|Array<Array<module:ol/coordinate~Coordinate>>),module:ol/render~State)}
* @typedef {function((import("../coordinate.js").Coordinate|Array<import("../coordinate.js").Coordinate>|Array<Array<import("../coordinate.js").Coordinate>>),import("../render.js").State)}
* RenderFunction
*/
/**
* @typedef {Object} Options
* @property {string|module:ol/geom/Geometry|module:ol/style/Style~GeometryFunction} [geometry] Feature property or geometry
* @property {string|import("../geom/Geometry.js").default|GeometryFunction} [geometry] Feature property or geometry
* or function returning a geometry to render for this style.
* @property {module:ol/style/Fill} [fill] Fill style.
* @property {module:ol/style/Image} [image] Image style.
* @property {module:ol/style/Style~RenderFunction} [renderer] Custom renderer. When configured, `fill`, `stroke` and `image` will be
* @property {import("./Fill.js").default} [fill] Fill style.
* @property {import("./Image.js").default} [image] Image style.
* @property {RenderFunction} [renderer] Custom renderer. When configured, `fill`, `stroke` and `image` will be
* ignored, and the provided function will be called with each render frame for each geometry.
* @property {module:ol/style/Stroke} [stroke] Stroke style.
* @property {module:ol/style/Text} [text] Text style.
* @property {import("./Stroke.js").default} [stroke] Stroke style.
* @property {import("./Text.js").default} [text] Text style.
* @property {number} [zIndex] Z index.
*/
@@ -147,7 +147,7 @@ import Stroke from '../style/Stroke.js';
*/
class Style {
/**
* @param {module:ol/style/Style~Options=} opt_options Style options.
* @param {Options=} opt_options Style options.
*/
constructor(opt_options) {
@@ -155,13 +155,13 @@ class Style {
/**
* @private
* @type {string|module:ol/geom/Geometry|module:ol/style/Style~GeometryFunction}
* @type {string|import("../geom/Geometry.js").default|GeometryFunction}
*/
this.geometry_ = null;
/**
* @private
* @type {!module:ol/style/Style~GeometryFunction}
* @type {!GeometryFunction}
*/
this.geometryFunction_ = defaultGeometryFunction;
@@ -171,31 +171,31 @@ class Style {
/**
* @private
* @type {module:ol/style/Fill}
* @type {import("./Fill.js").default}
*/
this.fill_ = options.fill !== undefined ? options.fill : null;
/**
* @private
* @type {module:ol/style/Image}
* @type {import("./Image.js").default}
*/
this.image_ = options.image !== undefined ? options.image : null;
/**
* @private
* @type {module:ol/style/Style~RenderFunction|null}
* @type {RenderFunction|null}
*/
this.renderer_ = options.renderer !== undefined ? options.renderer : null;
/**
* @private
* @type {module:ol/style/Stroke}
* @type {import("./Stroke.js").default}
*/
this.stroke_ = options.stroke !== undefined ? options.stroke : null;
/**
* @private
* @type {module:ol/style/Text}
* @type {import("./Text.js").default}
*/
this.text_ = options.text !== undefined ? options.text : null;
@@ -209,7 +209,7 @@ class Style {
/**
* Clones the style.
* @return {module:ol/style/Style} The cloned style.
* @return {import("./Style.js").default} The cloned style.
* @api
*/
clone() {
@@ -230,7 +230,7 @@ class Style {
/**
* Get the custom renderer function that was configured with
* {@link #setRenderer} or the `renderer` constructor option.
* @return {module:ol/style/Style~RenderFunction|null} Custom renderer function.
* @return {RenderFunction|null} Custom renderer function.
* @api
*/
getRenderer() {
@@ -240,7 +240,7 @@ class Style {
/**
* Sets a custom renderer function for this style. When set, `fill`, `stroke`
* and `image` options of the style will be ignored.
* @param {module:ol/style/Style~RenderFunction|null} renderer Custom renderer function.
* @param {RenderFunction|null} renderer Custom renderer function.
* @api
*/
setRenderer(renderer) {
@@ -249,7 +249,7 @@ class Style {
/**
* Get the geometry to be rendered.
* @return {string|module:ol/geom/Geometry|module:ol/style/Style~GeometryFunction}
* @return {string|import("../geom/Geometry.js").default|GeometryFunction}
* Feature property or geometry or function that returns the geometry that will
* be rendered with this style.
* @api
@@ -260,7 +260,7 @@ class Style {
/**
* Get the function used to generate a geometry for rendering.
* @return {!module:ol/style/Style~GeometryFunction} Function that is called with a feature
* @return {!GeometryFunction} Function that is called with a feature
* and returns the geometry to render instead of the feature's geometry.
* @api
*/
@@ -270,7 +270,7 @@ class Style {
/**
* Get the fill style.
* @return {module:ol/style/Fill} Fill style.
* @return {import("./Fill.js").default} Fill style.
* @api
*/
getFill() {
@@ -279,7 +279,7 @@ class Style {
/**
* Set the fill style.
* @param {module:ol/style/Fill} fill Fill style.
* @param {import("./Fill.js").default} fill Fill style.
* @api
*/
setFill(fill) {
@@ -288,7 +288,7 @@ class Style {
/**
* Get the image style.
* @return {module:ol/style/Image} Image style.
* @return {import("./Image.js").default} Image style.
* @api
*/
getImage() {
@@ -297,7 +297,7 @@ class Style {
/**
* Set the image style.
* @param {module:ol/style/Image} image Image style.
* @param {import("./Image.js").default} image Image style.
* @api
*/
setImage(image) {
@@ -306,7 +306,7 @@ class Style {
/**
* Get the stroke style.
* @return {module:ol/style/Stroke} Stroke style.
* @return {import("./Stroke.js").default} Stroke style.
* @api
*/
getStroke() {
@@ -315,7 +315,7 @@ class Style {
/**
* Set the stroke style.
* @param {module:ol/style/Stroke} stroke Stroke style.
* @param {import("./Stroke.js").default} stroke Stroke style.
* @api
*/
setStroke(stroke) {
@@ -324,7 +324,7 @@ class Style {
/**
* Get the text style.
* @return {module:ol/style/Text} Text style.
* @return {import("./Text.js").default} Text style.
* @api
*/
getText() {
@@ -333,7 +333,7 @@ class Style {
/**
* Set the text style.
* @param {module:ol/style/Text} text Text style.
* @param {import("./Text.js").default} text Text style.
* @api
*/
setText(text) {
@@ -352,7 +352,7 @@ class Style {
/**
* Set a geometry that is rendered instead of the feature's geometry.
*
* @param {string|module:ol/geom/Geometry|module:ol/style/Style~GeometryFunction} geometry
* @param {string|import("../geom/Geometry.js").default|GeometryFunction} geometry
* Feature property or geometry or function returning a geometry to render
* for this style.
* @api
@@ -363,7 +363,7 @@ class Style {
} else if (typeof geometry === 'string') {
this.geometryFunction_ = function(feature) {
return (
/** @type {module:ol/geom/Geometry} */ (feature.get(geometry))
/** @type {import("../geom/Geometry.js").default} */ (feature.get(geometry))
);
};
} else if (!geometry) {
@@ -371,7 +371,7 @@ class Style {
} else if (geometry !== undefined) {
this.geometryFunction_ = function() {
return (
/** @type {module:ol/geom/Geometry} */ (geometry)
/** @type {import("../geom/Geometry.js").default} */ (geometry)
);
};
}
@@ -392,11 +392,11 @@ class Style {
/**
* Convert the provided object into a style function. Functions passed through
* unchanged. Arrays of module:ol/style/Style or single style objects wrapped in a
* unchanged. Arrays of import("./Style.js").default or single style objects wrapped in a
* new style function.
* @param {module:ol/style/Style~StyleFunction|Array<module:ol/style/Style>|module:ol/style/Style} obj
* @param {StyleFunction|Array<import("./Style.js").default>|import("./Style.js").default} obj
* A style function, a single style, or an array of styles.
* @return {module:ol/style/Style~StyleFunction} A style function.
* @return {StyleFunction} A style function.
*/
export function toFunction(obj) {
let styleFunction;
@@ -405,14 +405,14 @@ export function toFunction(obj) {
styleFunction = obj;
} else {
/**
* @type {Array<module:ol/style/Style>}
* @type {Array<import("./Style.js").default>}
*/
let styles;
if (Array.isArray(obj)) {
styles = obj;
} else {
assert(obj instanceof Style,
41); // Expected an `module:ol/style/Style~Style` or an array of `module:ol/style/Style~Style`
41); // Expected an `Style` or an array of `Style`
styles = [obj];
}
styleFunction = function() {
@@ -424,20 +424,20 @@ export function toFunction(obj) {
/**
* @type {Array<module:ol/style/Style>}
* @type {Array<import("./Style.js").default>}
*/
let defaultStyles = null;
/**
* @param {module:ol/Feature|module:ol/render/Feature} feature Feature.
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
* @param {number} resolution Resolution.
* @return {Array<module:ol/style/Style>} Style.
* @return {Array<import("./Style.js").default>} Style.
*/
export function createDefaultStyle(feature, resolution) {
// We don't use an immediately-invoked function
// and a closure so we don't get an error at script evaluation time in
// browsers that do not support Canvas. (module:ol/style/Circle~CircleStyle does
// browsers that do not support Canvas. (import("./Circle.js").CircleStyle does
// canvas.getContext('2d') at construction time, which will cause an.error
// in such browsers.)
if (!defaultStyles) {
@@ -466,10 +466,10 @@ export function createDefaultStyle(feature, resolution) {
/**
* Default styles for editing features.
* @return {Object<module:ol/geom/GeometryType, Array<module:ol/style/Style>>} Styles
* @return {Object<import("../geom/GeometryType.js").default, Array<import("./Style.js").default>>} Styles
*/
export function createEditingStyle() {
/** @type {Object<module:ol/geom/GeometryType, Array<module:ol/style/Style>>} */
/** @type {Object<import("../geom/GeometryType.js").default, Array<import("./Style.js").default>>} */
const styles = {};
const white = [255, 255, 255, 1];
const blue = [0, 153, 255, 1];
@@ -537,8 +537,8 @@ export function createEditingStyle() {
/**
* Function that is called with a feature and returns its default geometry.
* @param {module:ol/Feature|module:ol/render/Feature} feature Feature to get the geometry for.
* @return {module:ol/geom/Geometry|module:ol/render/Feature|undefined} Geometry to render.
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature to get the geometry for.
* @return {import("../geom/Geometry.js").default|import("../render/Feature.js").default|undefined} Geometry to render.
*/
function defaultGeometryFunction(feature) {
return feature.getGeometry();