If you find it sometimes frustrating to work with JavaScript because of the reduced compile-time type checking or the limited Intellisense support in Visual Studio, I hope you have discovered TypeScript: http://www.typescriptlang.org/.

We have developed a TypeScript type definition file so that you can easily use GoJS in TypeScript code. We will include the GoJS.d.ts file in the release subdirectory of the site starting with version 1.2. But because GoJS 1.2 is completely compatible with 1.1, I believe you can use this type definition file even if you continue to use version 1.1 of GoJS as long as you do not use any of the new features.

EDIT: The following references are obsolete:

Get the file from github at: github.com/borisyankov/DefinitelyTyped/tree/master/goJS

Or get it through NuGet: NuGet Gallery | goJS.TypeScript.DefinitelyTyped 0.4.9

You can always get the latest at go.d.ts.

any plans on updating it for 1.7.1? :)

latest seems to be for 1.6.11.

Things have changed – don’t use DefinitelyTyped.

The TypeScript definition file is still in the release directory along with the go.js and go-debug.js libraries. However we have renamed it go.d.ts for consistency. Although the filename does not really matter when using the “typings” entry in package.json.


If you are using npm, just do:

npm install gojs

with appropriate save options, and use:

import * as go from "gojs";

I’m somewhat confused by the new typings file. For 1.6, I just put the file in a typings/GoJS folder and referenced it using

/// <reference path="typings/goJS/goJS.d.ts"/>

So after overwriting my current GoJS.d.ts with the 1.7 version, I now get hundred of compiler errors (Cannot find name ‘go’ mostly). Is something else required?

That depends on what environment you are using for compiling and which version of TypeScript that you are using.

I’m using Visual Studio 2015 and TypeScript 2.2

So am I. (Well, I just upgraded to VS2017.)

But I stopped using /// <reference .../> a long time ago.

I just diff’ed the go.d.ts files from 1.6.24 and 1.7.3. There aren’t that many differences, and I think all are due to new features in 1.7.

But perhaps from your point of view there were more significant differences within 1.6.*, as we switched to declaring the “go” namespace and not declaring a “go” module, and explicitly declaring exports. These were needed in order to work in more environments. Perhaps you were using an old version of the .d.ts file even before upgrading to version 1.7.

I changed the last line from

export = go;


declare module "go" { export = go; }

which fixed it for me. May be of use to people who aren’t using a module loader so can’t use import (from my understanding at least)