AnsweredAssumed Answered

Typescript error TS2349 on view.goTo

Question asked by di_minglei on Dec 18, 2017
Latest reply on Dec 21, 2017 by di_minglei

When using MapView.goTo, it always gives Typescript error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((target: Geometry | Graphic | Graphic[] | Viewpoint | number[] | Geometry[] | MapViewGoToTarget,...' has no compatible call signatures.

The goto function working fine, just this tslint error breaks the build.

Does anyone have similar issues? below is my code:

if(matchedGraphic != null) {
let point = matchedGraphic.geometry as Point;
this.view.goTo({
center: [point.longitude, point.latitude],
zoom: 8
}, {
speedFactor: 6,
easing: "linear"
});

this.view.popup.open({
features: [matchedGraphic], // array of graphics
featureMenuOpen: true, // selected features initially display in a list
location: matchedGraphic.geometry
});
}

 

The typing file is:

goTo(target: number[] | Geometry | Geometry[] | Graphic | Graphic[] | Viewpoint | MapViewGoToTarget, options?: MapViewGoToOptions): IPromise<ViewAnimation>;

 

Just don't understand why tslint give this error, can someone shed some lights?

 

Thanks!

Outcomes