Using LogRocket with Typescript

Typescript definitions are already included in the LogRocket SDK package. There is no separate typings package to install.


You can import LogRocket in any of the following ways:

// Choice 1: CommonJS import
import LogRocket = require('logrocket');
// This is semantically correct and is the preferred method of importing

// Choice 2: ES6 import syntax
import * as LogRocket from 'logrocket';
// This works since Typescript makes it work, but it's not following
// the ECMAScript Module specification correctly.