assemblyai-node-sdk icon indicating copy to clipboard operation
assemblyai-node-sdk copied to clipboard

tsc errors 'error TS2304: Cannot find name'

Open Swimburger opened this issue 1 year ago • 1 comments

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:

  • More info: https://github.com/microsoft/TypeScript/issues/31894

Swimburger avatar Mar 08 '24 16:03 Swimburger

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.

Swimburger avatar Mar 08 '24 19:03 Swimburger