-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsecond-console.d.ts
34 lines (31 loc) · 974 Bytes
/
second-console.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// https://stackoverflow.com/questions/52677576/typescript-discriminated-union-allows-invalid-state/52678379
declare type UnionKeys<T> = T extends T ? keyof T : never;
declare type StrictUnionHelper<T, TAllKeys extends PropertyKey> = T extends any
? T & Partial<Record<Exclude<TAllKeys, keyof T>, never>>
: never;
declare type StrictUnion<T> = StrictUnionHelper<T, UnionKeys<T>>;
declare type ConsoleConnectionType = StrictUnion<
| {
port: number;
host?: string;
}
| {
seed: string;
}
| {
path: string;
}
| {}
>;
declare type ConsoleParameter = ConsoleConnectionType & {
reconnect?: boolean;
wait?: boolean;
clearConsole?: boolean;
};
import { Console } from "node:console";
declare class SecondConsole extends Console {
constructor(params?: ConsoleParameter);
static createIPCPath(seed: string): string;
static createRequire(console: Console, __parent: string): NodeJS.Require;
}
export default SecondConsole;