AssemblyAI / assemblyai-node-sdk

The AssemblyAI JavaScript SDK provides an easy-to-use interface for interacting with the AssemblyAI API, which supports async and real-time transcription, audio intelligence models, as well as the latest LeMUR models.
https://www.assemblyai.com
MIT License
38 stars 11 forks source link

tsc errors 'error TS2304: Cannot find name' #38

Open Swimburger opened 8 months ago

Swimburger commented 8 months ago

Running tsc in my app results in the following error.

node_modules/assemblyai/dist/services/realtime/service.d.ts:23:15 - error TS2304: Cannot find name 'WritableStream'.

23     stream(): WritableStream<AudioData>;
                 ~~~~~~~~~~~~~~

node_modules/assemblyai/dist/types/files/index.d.ts:3:47 - error TS2304: Cannot find name 'ReadableStream'.

3 type FileUploadData = NodeJS.ReadableStream | ReadableStream | Blob | BufferSource | ArrayBufferView | ArrayBufferLike | Uint8Array;
                                                ~~~~~~~~~~~~~~

node_modules/assemblyai/dist/types/files/index.d.ts:3:71 - error TS2304: Cannot find name 'BufferSource'.

3 type FileUploadData = NodeJS.ReadableStream | ReadableStream | Blob | BufferSource | ArrayBufferView | ArrayBufferLike | Uint8Array;

A solution in TS is still being discussed:

Swimburger commented 8 months ago

I tried fixing this the way AWS SDK does: https://github.com/aws/aws-sdk-js-v3/pull/3889/files Unfortunately, not all types in the error are interfaces, and the fix only works for interfaces. For now, I suggest using the DOM lib in TS.