Skip to content

Commit

Permalink
fix produced .d.ts
Browse files Browse the repository at this point in the history
- fix index.d.ts to properly use commonjs "export =" syntax
- output the native .d.ts. while the end user should not
  need to call C++ methods, this way we reduce transitive
  typechecking errors.
  • Loading branch information
mildsunrise committed Nov 2, 2023
1 parent 9be58d9 commit 598eb96
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
export * from "./build/types/RTMPServer";

export type { default as Server } from "./build/types/Server";
export type { default as Application } from "./build/types/Application";
export type { default as Client } from "./build/types/Client";
export type { default as Stream, AMFData, Command } from "./build/types/Stream";
export type { default as IncomingStreamBridge, StreamStats } from "./build/types/IncomingStreamBridge";
export type Server = import("./build/types/Server");
export type Application = import("./build/types/Application");
export type Client = import("./build/types/Client");
export type Stream = import("./build/types/Stream");
export type IncomingStreamBridge = import("./build/types/IncomingStreamBridge");
export type IncomingStreamTrackBridge = import("./build/types/IncomingStreamTrackBridge");

export type {
default as IncomingStreamTrackBridge,
ActiveEncodingInfo, ActiveLayersInfo,
EncodingStats, LayerStats, MediaStats, PacketWaitTime, TrackStats,
} from "./build/types/IncomingStreamTrackBridge";

export type { AMFData, Command } from "./build/types/Stream";
export type { StreamStats } from "./build/types/IncomingStreamBridge";
File renamed without changes.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "RTMP Server by Medooze",
"main": "index.js",
"scripts": {
"prepare": "tsc --checkJs false",
"prepare": "tsc --checkJs false && mkdir -p build/src && cp src/*.d.ts build/src",
"check": "tsc --noEmit --emitDeclarationOnly false",
"configure": "node-gyp configure",
"swig": "swig -javascript -node -c++ src/rtmp-server.i",
Expand Down

0 comments on commit 598eb96

Please sign in to comment.