Fix ban-type lint

This commit is contained in:
Olivier Sechet
2018-03-08 09:23:57 +01:00
committed by Olivier Sechet
parent 5b409b39e8
commit c1295d24ee
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; }
/**
* @namespace ol
@@ -1491,6 +1491,9 @@ declare module ol {
}
}
/* From ol/typedefs.js */
type EventsListenerFunctionType = ((evt: ol.events.Event) => void) | ((evt: ol.events.Event) => boolean);
/**
* @namespace ol.extent
*/
@@ -7957,7 +7960,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.
@@ -7969,7 +7972,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.
@@ -7979,7 +7982,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;
}
/**
@@ -11694,7 +11697,7 @@ declare module ol {
* target: (EventTarget|ol.events.EventTarget),
* type: string}}
*/
type EventsKey = Object;
type EventsKey = GlobalObject;
/**
* An array of numbers representing an extent: `[minx, miny, maxx, maxy]`.
@@ -11995,7 +11998,7 @@ declare module ol {
* @typedef {{numberOfFeatures: number,
* bounds: ol.Extent}}
*/
type WFSFeatureCollectionMetadata = Object;
type WFSFeatureCollectionMetadata = GlobalObject;
/**
* Total deleted; total inserted; total updated; array of insert ids.
@@ -12004,7 +12007,7 @@ declare module ol {
* totalUpdated: number,
* insertIds: Array.<string>}}
*/
type WFSTransactionResponse = Object;
type WFSTransactionResponse = GlobalObject;
/**
* @constructor
+9 -8
View File
@@ -6,8 +6,9 @@ let stringValue: string;
let stringArray: string[];
let jsonValue: JSON;
let domEventTarget: EventTarget;
let fn: Function;
let object: Object;
let listener: ol.EventsListenerFunctionType;
let object: { [key: string]: any };
let fn: () => void;
// Callback predefinitions for OpenLayers
let preRenderFunction: ol.PreRenderFunction;
@@ -579,12 +580,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,
// This currently fails for an option that does not appear to be in OL 4
"no-any-union": false,
// Not sure how to work around this, or if it's necessary to