August 4, 2019

Typescript definition for Forge Viewer v7 released!

Today marks the GA release of the much anticipated Typescript definitions for Forge Viewer v7.0! As always we will continue our endeavors to keep abreast with the latest updates (v7.1 and up) and see the Feedback section below if you'd like to contribute to definitions - we can really use your greatly appreciated input!

Prerequisites

 

  • TypeScript 2.x or later (for 1.x we recommend to upgrade your project - see here for details.
  • Package manager: NPM

Usage

To use these definitions in your TypeScript project, install and import them separately as stand-alone dependencies as appropriate to your requirements.

Forge Viewer

Install @type/forge-viewer

npm install --save-dev @types/three @types/forge-viewer #three.js types are required

Reference the definitions in your TypeScript configurations:

// tsconfig.json or your framework-specific config file such as tsconfig.app.json
{
    "types": ["forge-viewer"]
}

 

Code Sample

We've updated our Viewer TypeScript sample to adopt these definitions. This should be a great start for anyone looking to dive into TypeScript with Forge Viewer as well.

Feedback

Feel free to chip in with suggestions, bug reports and feature requests by creating an issue or pull request to the following repositories:
https://github.com/dukedhx/DefinitelyTyped/ (source files can be found here (Forge Viewer) and here (Forge API Node.js Client SDK)
https://github.com/Autodesk-Forge/viewer-nodejs-typeview.sample

Alternatively you can follow the official guide here to report an issue - be sure to tag me (Bryan Huang) in your request so we can be notified and attend to it.

Credits

Hats off to Jan Liska (@liskaj71) and Kean Walmsley (@keanw) for contributing to the definitions. Thanks gents!

Related Posts