Question on using the Recenter demo widget w/in TypeScript

344
0
03-28-2019 04:15 PM
JohnCartwright3
New Contributor II

Hello All,

I was following along with the custom Recenter widget example in the JSAPI docs and found that I had to make a few changes to get it to work.  Being very much a newcomer to TypeScript, I was hoping someone could explain what I'm missing.

I have a main.ts file into which I'm importing the custom widget:

import { Recenter } from "app/Recenter";
Then in the Recenter.tsx, I had to change the export and add a dummy parameter to the constructor:
@subclass("esri.widgets.Recenter")
export class Recenter extends declared(Widget) {
  constructor(args:any) {
  super();
  this._onViewChange = this._onViewChange.bind(this)
}

The above changes work, I'm just not clear why the sample required modification.

Thanks!

--john

0 Kudos
0 Replies