Merge pull request #24143 from osechet/feature/clean-ban-type

[openlayers] Fix the ban-type lint
This commit is contained in:
Armando Aguirre
2018-03-09 14:57:14 -08:00
committed by GitHub
3 changed files with 19 additions and 17 deletions
+10 -7
View File
@@ -11,7 +11,7 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Definitions partially generated using tsd-jsdoc (https://github.com/englercj/tsd-jsdoc)
declare type GlobalObject = Object;
interface GlobalObject { [key: string]: any; }
declare module ol {
/**
@@ -1385,6 +1385,9 @@ declare module ol {
}
}
/* From ol/typedefs.js */
type EventsListenerFunctionType = ((evt: ol.events.Event) => void) | ((evt: ol.events.Event) => boolean);
module extent {
/**
* Build an extent that includes all given coordinates.
@@ -7296,7 +7299,7 @@ declare module ol {
* will be an array of keys.
* @api stable
*/
on(type: (string | string[]), listener: Function, opt_this?: GlobalObject): (ol.EventsKey | ol.EventsKey[]);
on(type: (string | string[]), listener: ol.EventsListenerFunctionType, opt_this?: GlobalObject): (ol.EventsKey | ol.EventsKey[]);
/**
* Listen once for a certain type of event.
@@ -7308,7 +7311,7 @@ declare module ol {
* will be an array of keys.
* @api stable
*/
once(type: (string | string[]), listener: Function, opt_this?: GlobalObject): (ol.EventsKey | ol.EventsKey[]);
once(type: (string | string[]), listener: ol.EventsListenerFunctionType, opt_this?: GlobalObject): (ol.EventsKey | ol.EventsKey[]);
/**
* Unlisten for a certain type of event.
@@ -7318,7 +7321,7 @@ declare module ol {
* `listener`.
* @api stable
*/
un(type: (string | string[]), listener: Function, opt_this?: GlobalObject): void;
un(type: (string | string[]), listener: ol.EventsListenerFunctionType, opt_this?: GlobalObject): void;
}
/**
@@ -10778,7 +10781,7 @@ declare module ol {
* Key to use with {@link ol.Observable#unByKey}.
*
*/
type EventsKey = Object;
type EventsKey = GlobalObject;
/**
* An array of numbers representing an extent: `[minx, miny, maxx, maxy]`.
@@ -11002,12 +11005,12 @@ declare module ol {
/**
* Number of features; bounds/extent.
*/
type WFSFeatureCollectionMetadata = Object;
type WFSFeatureCollectionMetadata = GlobalObject;
/**
* Total deleted; total inserted; total updated; array of insert ids.
*/
type WFSTransactionResponse = Object;
type WFSTransactionResponse = GlobalObject;
/**
* @param tileCoord Tile coordinate.
+9 -8
View File
@@ -3,12 +3,13 @@ let anyValue: any;
let booleanValue: boolean;
let canvas: HTMLCanvasElement;
let domEventTarget: EventTarget;
let fn: Function;
let fn: () => void;
let image: HTMLImageElement;
let jsonValue: JSON;
let listener: ol.EventsListenerFunctionType;
let numberArray: number[];
let numberValue: number;
let object: Object;
let object: { [key: string]: any };
let stringArray: string[];
let stringValue: string;
@@ -584,12 +585,12 @@ observable.dispatchEvent({ type: stringValue, a: numberValue, b: stringValue, c:
observable.dispatchEvent(olEvent);
observable.dispatchEvent(stringValue);
numberValue = observable.getRevision();
eventKeyMixed = observable.on(stringValue, fn);
eventKeyMixed = observable.on([stringValue, stringValue], fn, {});
eventKeyMixed = observable.once(stringValue, fn);
eventKeyMixed = observable.once([stringValue, stringValue], fn, {});
observable.un(stringValue, fn);
observable.un([stringValue, stringValue], fn, {});
eventKeyMixed = observable.on(stringValue, listener);
eventKeyMixed = observable.on([stringValue, stringValue], listener, {});
eventKeyMixed = observable.once(stringValue, listener);
eventKeyMixed = observable.once([stringValue, stringValue], listener, {});
observable.un(stringValue, listener);
observable.un([stringValue, stringValue], listener, {});
//
// ol.proj
-2
View File
@@ -1,8 +1,6 @@
{
"extends": "dtslint/dt.json",
"rules": {
// It appears somewhat difficult to remove the Function and Object types
"ban-types": false,
// Not sure how to work around this, or if it's necessary to
"no-declare-current-package": false,
"no-internal-module": false,