Skip to content

Node.js Setup Guide Clarity #88

@jmielbrecht-symetrix

Description

@jmielbrecht-symetrix

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:

  1. 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
  2. An update to the JavaScript SDK that expects the SubtleCrypto type instead of a Function type for the subtleCrypto option (see sdk/dist/telemetrydeck.d.ts, specifically the TelemetryDeckOptions type 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.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions