bbc / peaks.js

JavaScript UI component for interacting with audio waveforms

Home Page:https://waveform.prototyping.bbc.co.uk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Export PeaksInstance interface

DavraYoung opened this issue Β· comments

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Today I used patch-package to patch peaks.js@2.1.0 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/peaks.js/peaks.js.d.ts b/node_modules/peaks.js/peaks.js.d.ts
index da9907c..6349ea2 100644
--- a/node_modules/peaks.js/peaks.js.d.ts
+++ b/node_modules/peaks.js/peaks.js.d.ts
@@ -443,7 +443,7 @@ declare module 'peaks.js' {
     setZoom: (options: XOR<{ scale: number | 'auto' }, { seconds: number | 'auto' }>) => void;
   }
 
-  interface PeaksInstance {
+  export interface PeaksInstance {
     setSource: (options: SetSourceOptions, callback: SetSourceCallback) => void;
     destroy: () => void;
     /** Player API */

This issue body was partially generated by patch-package.

I'm currently importing PeaksInstance into a TypeScript Angular app (code), so how is this working but without export? What problem did this change fix for you?

@chrisn hi. idk why in your case it works as expected. Probably different tsconfig or typescript version, but in my react project typescript resolves this as any and states that PeaksInstance cannot be found in the module. I fixed it by patching the package

Hi! Thanks, that's curious, I'd be interested to know how it worked without export.