Skip to content

Commit

Permalink
fix: Make index typed (#403)
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach authored Aug 8, 2024
1 parent 0a677a8 commit 04dafea
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
16 changes: 0 additions & 16 deletions index.js

This file was deleted.

16 changes: 16 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { RemoteDebugger, REMOTE_DEBUGGER_PORT } from './lib/remote-debugger';
import { RemoteDebuggerRealDevice } from './lib/remote-debugger-real-device';
import type { RemoteDebuggerRealDeviceOptions, RemoteDebuggerOptions } from './lib/types';

export function createRemoteDebugger<T extends boolean> (
opts: T extends true ? RemoteDebuggerRealDeviceOptions : RemoteDebuggerOptions,
realDevice: T
): T extends true ? RemoteDebuggerRealDevice : RemoteDebugger {
// @ts-ignore TS does not understand that
return realDevice
? new RemoteDebuggerRealDevice(opts as RemoteDebuggerRealDeviceOptions)
: new RemoteDebugger(opts);
}

export { RemoteDebugger, RemoteDebuggerRealDevice, REMOTE_DEBUGGER_PORT };
export type { RemoteDebuggerRealDeviceOptions, RemoteDebuggerOptions };
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"lib": "lib"
},
"files": [
"index.js",
"index.ts",
"lib",
"build",
"scripts",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"checkJs": true
},
"include": [
"index.js",
"index.ts",
"lib"
]
}

0 comments on commit 04dafea

Please sign in to comment.