diff --git a/types/amap-js-api/amap-js-api-tests.ts b/types/amap-js-api/amap-js-api-tests.ts index 0a2c1426b2..f1f699d32e 100644 --- a/types/amap-js-api/amap-js-api-tests.ts +++ b/types/amap-js-api/amap-js-api-tests.ts @@ -60,6 +60,16 @@ testArrayBounds.getCenter(); // $ExpectType Bounds const testBounds = new AMap.Bounds(lnglat, lnglat); +// $ExpectType Bounds +new AMap.Bounds(); +// $ExpectError +new AMap.Bounds([0, 0, 0]); +// $ExpectType Bounds +new AMap.Bounds([0, 0, 0, 0]); +// $ExpectType Bounds +new AMap.Bounds(lnglatTuple, lnglatTuple); +// $ExpectType Bounds +new AMap.Bounds(0, 0, 0, 0); // $ExpectType boolean testBounds.contains(lnglat); diff --git a/types/amap-js-api/bounds.d.ts b/types/amap-js-api/bounds.d.ts index f594969292..caba988fb2 100644 --- a/types/amap-js-api/bounds.d.ts +++ b/types/amap-js-api/bounds.d.ts @@ -1,11 +1,24 @@ declare namespace AMap { class Bounds { + /** + * 地物对象的经纬度矩形范围。 + * @param coords 由西南角,东北角经纬度组成的数组,分别是[西南角经度, 西南角纬度,东北角经度,东北角纬度] + */ + constructor(coords?: [number, number, number, number]); /** * 地物对象的经纬度矩形范围。 * @param southWest 西南角经纬度 * @param northEast 东北角经纬度 */ - constructor(southWest: LngLat, northEast: LngLat); + constructor(southWest: LocationValue, northEast: LocationValue); + /** + * 地物对象的经纬度矩形范围。 + * @param southWestLng 西南角经度 + * @param southWestLat 西南角纬度 + * @param northEastLng 东北角经度 + * @param northEastLat 东北角纬度 + */ + constructor(southWestLng: number, southWestLat: number, northEastLng: number, northEastLat: number); /** * 指定点坐标是否在矩形范围内 * @param point 制定坐标 diff --git a/types/amap-js-api/event.d.ts b/types/amap-js-api/event.d.ts index d90ee4c720..af908ed626 100644 --- a/types/amap-js-api/event.d.ts +++ b/types/amap-js-api/event.d.ts @@ -8,10 +8,9 @@ declare namespace AMap { * @param once 触发一次 * @param unshift 更改事件顺序 */ - on( + on( eventName: string, - // tslint:disable-next-line:no-unnecessary-generics - handler: (this: C, event: E) => void, + handler: (this: C, event: any) => void, context?: C, once?: boolean, unshift?: boolean @@ -22,10 +21,10 @@ declare namespace AMap { * @param handler 事件功能函数 * @param context 事件上下文 */ - off( + off( eventName: string, // tslint:disable-next-line - handler: ((this: C, event: E) => void) | 'mv', + handler: ((this: C, event: any) => void) | 'mv', context?: C ): this; /** @@ -61,12 +60,12 @@ declare namespace AMap { * @param handler 事件功能函数 * @param context 事件上下文 */ - function addListener( + function addListener( // tslint:disable-next-line: no-unnecessary-generics instance: I, eventName: string, // tslint:disable-next-line: no-unnecessary-generics - handler: (this: C, event: E) => void, + handler: (this: C, event: any) => void, // tslint:disable-next-line: no-unnecessary-generics context?: C ): EventListener<1>; @@ -77,12 +76,12 @@ declare namespace AMap { * @param handler 事件功能函数 * @param context 事件上下文 */ - function addListenerOnce( + function addListenerOnce( // tslint:disable-next-line: no-unnecessary-generics instance: I, eventName: string, // tslint:disable-next-line: no-unnecessary-generics - handler: (this: C, event: E) => void, + handler: (this: C, event: any) => void, // tslint:disable-next-line: no-unnecessary-generics context?: C ): EventListener<1>;