rtsp-relay icon indicating copy to clipboard operation
rtsp-relay copied to clipboard

TS failed app build: An export assignment cannot be used in a module with other exported elements."

Open hkar19 opened this issue 3 years ago • 1 comments

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/rtsp-relay/index.d.ts b/node_modules/rtsp-relay/index.d.ts
index 0b72c1f..3aa3486 100644
--- a/node_modules/rtsp-relay/index.d.ts
+++ b/node_modules/rtsp-relay/index.d.ts
@@ -1,19 +1,21 @@
-declare function _exports(app: Application, server?: import("http").Server | import("https").Server): {
-    /**
-     * You must include a script tag in the HTML to import this script
-     *
-     * Alternatively, if you have set up a build process for front-end
-     * code, you can import it instead:
-     * ```js
-     * import { loadPlayer } from "rtsp-relay/browser";
-     * ```
-     */
-    scriptUrl: string;
-    killAll(): void;
-    /** @param {Options} props */
-    proxy({ url, verbose, ...options }: Options): (ws: WebSocket) => void;
-};
-export = _exports;
+declare module "rtsp-relay" {
+    export default function _exports(app: Application, server?: import("http").Server | import("https").Server): {
+        /**
+         * You must include a script tag in the HTML to import this script
+         *
+         * Alternatively, if you have set up a build process for front-end
+         * code, you can import it instead:
+         * ```js
+         * import { loadPlayer } from "rtsp-relay/browser";
+         * ```
+         */
+        scriptUrl: string;
+        killAll(): void;
+        /** @param {Options} props */
+        proxy({ url, verbose, ...options }: Options): (ws: WebSocket) => void;
+    }
+}
+
 export type Options = {
     url: string;
     additionalFlags?: string[];

This issue body was partially generated by patch-package.

hkar19 avatar Jan 18 '22 05:01 hkar19

Hi, you don't need to do this. You can just add "esModuleInterop": true to tsconfig.json

k-yle avatar Jan 18 '22 20:01 k-yle