DefinitelyTyped/types/amap-js-api-map-type/amap-js-api-map-type-tests.ts
Nathan Shively-Sanders fbb3688b15
Make ExpectError locations same for TS 3.8 (#41431)
* Make ExpectError locations same for TS 3.8

Error locations changed for some object literals in TS 3.8. This breaks
tests that use ExpectError since the ExpectError needs to be closer to
the actual error.

To fix this, I merged a lot of multi-line object literals into one-line
literals.

* remove stray edit
2020-01-06 14:11:45 -08:00

31 lines
590 B
TypeScript

declare const map: AMap.Map;
// $ExpectType MapType
new AMap.MapType();
// $ExpectType MapType
new AMap.MapType({});
// $ExpectType MapType
const mapType = new AMap.MapType({
defaultType: 1,
showTraffic: true,
showRoad: true
});
// $ExpectError
new AMap.MapType({ defaultType: 2 });
// $ExpectType void
mapType.show();
// $ExpectType void
mapType.hide();
mapType.on('show', (event: AMap.MapType.EventMap['show']) => {
// $ExpectType "show"
event.type;
});
mapType.on('hide', (event: AMap.MapType.EventMap['hide']) => {
// $ExpectType "hide"
event.type;
});