AnsweredAssumed Answered

DOM not rendering in TypeScript widget in 4.3 -> 4.8 upgrade

Question asked by vandervoort on Sep 26, 2018
Latest reply on Sep 28, 2018 by vandervoort

We have a JSAPI v.4.3 application that we wanted to upgrade to 4.8. The application uses custom widgets that are built on TypeScript. I upgraded the TypeScript definitions when I changes the JSAPI version from 4.3 to 4.8.


The 4.3 JS application uses:

      var view = new MapView({

        map: webmap,

        container: "viewDiv"



        // do something with e


At 4.8, view.then() is replaced with view.when()

However, this affects the constructor of our custom widgets (in TypeScript tsx file). Specifically:

    render() {

        return (




                <!-- build a DOM here -->





The application is failing with an error in Chrome:

Uncaught (in promise) TypeError: Cannot read property 'createElement' of undefined at Object.MyWidget.render (MyWidget.tsx:50)

Stepping through code in the debugger indicates that this exception occurs in the view.when(). The 'createElement' property indicates to me that an attempt is being made to create the DOM but that it cannot find itself. (?)


The application is failing with an error in Firefox and MS browsers that are not thrown to the console – instead an alert is displayed in the browser (FF) or Developer Tools (MS) with the following text:

Could not locate http://<URL>/<path>/MyWidget.tsx specified in http://<URL>/<path>/MyWidget.js.

I have verified that the tsx is correctly specified in the js file, even though the browser says otherwise.


I’m not sure how to reconcile these different exceptions, let alone resolve this issue. It is critical that we render the DOM, as it encapsulated our business logic. Does anyone have any thoughts on this issue? TIA