-
Notifications
You must be signed in to change notification settings - Fork 16
Description
Is your feedback related to a problem? Please describe.
The documentation for setting up TelemetryDeck for Node.js apps conflicts with the library's expected type expected for the subtleCrypto option in the TelemetryDeck constructor.
To set up TelemetryDeck in Node, this guide instructs the user to include the following:
import TelemetryDeck from '@telemetrydeck/sdk';
import crypto from 'crypto';
const td = new TelemetryDeck({
appID: '<YOUR_APP_ID>'
clientUser: '<YOUR_USER_IDENTIFIER>',
subtleCrypto: crypto.webcrypto.subtle,
});
However, when doing so, I am immediately greeted with the following TypeScript error:
Type 'SubtleCrypto' is missing the following properties from type 'Function': apply, call, bind, prototype, and 6 more.ts(2740)
Describe the solution you'd like or the information you're missing
I'd either appreciate:
- an update to the documentation that (a) provides a disclaimer for Typescript users or (b) gives a valid TelemetryDeck initialization step for Typescript users OR
- An update to the JavaScript SDK that expects the
SubtleCryptotype instead of a Function type for thesubtleCryptooption (see sdk/dist/telemetrydeck.d.ts, specifically theTelemetryDeckOptionstype declaration).
Additional context
I'm attempting to implement TelemetryDeck in an Electron + Typescript + React app running on Node and was using the setup guide for Node.js applications. I assumed the Node.js app guide would be compatible with Typescript but could be wrong.