slash9494 / react-modern-audio-player

πŸ”Š Simple, accessible and flexible audio player
MIT License
276 stars 17 forks source link

Type error: Cannot find name 'WaveSurfer' thrown when building Nextjs app. #12

Open kobbiman opened 1 year ago

kobbiman commented 1 year ago

Hi! πŸ‘‹

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

Today I used patch-package to patch react-modern-audio-player@1.4.0-rc.2 for the project I'm working on.

I get the following errors when trying to build Nextjs app.

See screenshots below:

Screen Shot 2023-03-20 at 12 44 04 Screen Shot 2023-03-20 at 12 46 07

Here is the diff that solved my problem:

diff --git a/node_modules/react-modern-audio-player/dist/types/components/AudioPlayer/Context/StateContext/element.d.ts b/node_modules/react-modern-audio-player/dist/types/components/AudioPlayer/Context/StateContext/element.d.ts
index 1ea5885..c9b2a90 100644
--- a/node_modules/react-modern-audio-player/dist/types/components/AudioPlayer/Context/StateContext/element.d.ts
+++ b/node_modules/react-modern-audio-player/dist/types/components/AudioPlayer/Context/StateContext/element.d.ts
@@ -1,5 +1,6 @@
 import { ReactNode } from "react";
 import { AudioData } from "./audio";
+import type WaveSurfer from "wavesurfer.js";
 export declare type PlayList = Array<AudioData>;
 export declare type ProgressUI = "waveform" | "bar" | false;
 export declare type PlayListUI = "sortable" | "unSortable" | false;
diff --git a/node_modules/react-modern-audio-player/dist/types/components/Grid/Item.d.ts b/node_modules/react-modern-audio-player/dist/types/components/Grid/Item.d.ts
index 068e93e..f469c9d 100644
--- a/node_modules/react-modern-audio-player/dist/types/components/Grid/Item.d.ts
+++ b/node_modules/react-modern-audio-player/dist/types/components/Grid/Item.d.ts
@@ -1,6 +1,6 @@
 import { ViewProps } from "@react-spectrum/view";
 import { DOMRefValue } from "@react-types/shared";
-export interface GridItemProps extends Omit<ViewProps, "children"> {
+export interface GridItemProps extends Omit<ViewProps<any>, "children"> {
     visible?: boolean;
     children: React.ReactNode;
 }

This issue body was partially generated by patch-package.