Error in using dojo grid in typescript with esri JavaScript API

Jump to solution
06-29-2020 06:24 AM
New Contributor III


Trying create dojo grid.

when importing the below statements I get below error. I have installed dojo typings  

import dgrid from "dgrid/Grid";

import Memory from "dojo/store/Memory";

import StoreAdapter from "dstore/legacy/StoreAdapter";

import Selection from  "dgrid/Selection";


'Memory' is declared but its value is never read.ts(6133)

Cannot find module 'dojo/store/Memory' or its corresponding type declarations.ts(2307)


'dgrid' is declared but its value is never read.ts(6133)

Cannot find module 'dgrid/Grid' or its corresponding type declarations.ts(2307)

0 Kudos
1 Solution

Accepted Solutions
New Contributor III
I missed add the reference
///<reference path= '../node_modules/dojo-typings/custom/dgrid/1.1/dgrid.d.ts' />

View solution in original post

5 Replies
New Contributor III
I missed add the reference
///<reference path= '../node_modules/dojo-typings/custom/dgrid/1.1/dgrid.d.ts' />
New Contributor III

Edited: for those of us uninitiated in typescript, what divya bathina‌ is describing is using a triple slash directive. Putting this directive at the top of a .ts file helps the tsc figure out where to look for the typings. 

Frequent Contributor

Hi Ryan Gatchell‌ thank you for explaining! I am afraid I'm still not getting it to work. I installed the tpyings in npm.  I am using the Esri Loader template from Git. I just installed everything so it is the latest versions; and I updated all packages with NPM's NCU updater. The reason I am hoping to use it is to use the old 'dnd Moveable' to make popups moveable again in API 4.x.  

Here is my tsconfig. I also experimented and removed temporarily the "node_modules". And it's in package.json in devdependencies and I even experimented adding it to dependencies though I don't it is needed for run time.

Thoughts??? This is my first foray into Typescript, API 4 etc.

 "compilerOptions": {
 "module": "amd",
 "noImplicitAny": true,
 "esModuleInterop": true,
 "sourceMap": true,
 "jsx": "react",
 "jsxFactory": "tsx",
 "target": "es5",
 "experimentalDecorators": true,
 "preserveConstEnums": true,
 "suppressImplicitAnyIndexErrors": true,
 "importHelpers": true,
 "moduleResolution": "node"
 "include": [

 "exclude": [

I even put ///<reference path= '../node_modules/dojo-typings/dojo/1.11/dnd.d.ts' /> at the top of my main.js file. Here is the top of my main.js file:

///<reference path= '../node_modules/dojo-typings/dojo/1.11/dnd.d.ts' />

import EsriMap from "esri/Map";
import MapView from "esri/views/MapView";
import FeatureLayer from "esri/layers/FeatureLayer";
import MapImageLayer from "esri/layers/MapImageLayer";
import LayerList from "esri/widgets/LayerList";
import Popup from "esri/widgets/Popup";
import PopupTemplate from "esri/PopupTemplate";
import Sublayer from "esri/layers/support/Sublayer";
import esri = __esri;

///all of the below FAIL it says cannot find Module::::///////////

import Moveable from "dojo-typings/dojo/1.11/dnd"; 
import On from "dojo-typings/dojo/1.11/on";
import domClass from "dojo-typings/dojo/1.11/dom-class"

const map = new EsriMap({
 basemap: "streets-vector",
 layers: []

0 Kudos
New Contributor III

Kevin MacLeod I think the issue you're experiencing is due to wrong paths in your import statements; the dojo-typings should just contain the classes for typescript not the actual JavaScript modules. The 4.x API is a bit different than the 3.x and a lot of things you would have used dojo's "on" for  already have built in on methods in 4.x. 

0 Kudos
Frequent Contributor

Hi Ryan Gatchell, hm should the dnd/Moveable work out of the box? I am wondering how to access Dojo modules since API 4x apparently still uses Dojo 1x. Is ESRI moving to Dojo2 and if so, what is timeframe and migration strategy? 

Yea..I realized On and domclass etc type of functionality should have equivalent methods in the Esri API. Searching the API 4x page all the old Dojo utilities and modules are gone though. I guess View UI is how we manipulate DOM now? UI | ArcGIS API for JavaScript 4.16  though I am trying to figure out how. I just created this as an idea for future enhancement along with autofit property allow any widget or element to be draggable/resizable (add Draggable and Resizable properties to Vie...  

I really just need 'dnd' (not dungeons and dragons) for the Moveable to put the popup inside of.   Interestingly enough this has not been a question yet at least that I can see here for 4x.  I'll keep experimenting...  I appreciate your time!   I know this will help many others with the moving popup question. if I figure it out I'll update everybody and post the code. Here it is so far  GitHub - kevinsagis/Esri4xAPItest: Esri 4x API test with Dojo 1x moveable popup window 

update...I'm working on this today... I have noticed a few more things here I have to try - How To Use · dojo/typings Wiki · GitHub 

Edit: I've moved on from this. Here is a moving popup using jQuery 

0 Kudos