Skip to content

Commit

Permalink
refactor: simplify interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
andreashuber69 committed Mar 9, 2023
1 parent b2b3e0e commit 12c2e3b
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/InOut.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
// https://github.com/andreashuber69/verify-coldcard-dice-seed/blob/develop/README.md#----verify-coldcard-dice-seed
type InNames = "once" | "pause" | "resume";

export type GenericIn<T extends keyof NodeJS.ReadStream> = Pick<NodeJS.ReadStream, T>;

export type GenericOut<T extends keyof NodeJS.WriteStream> = Pick<NodeJS.WriteStream, T>;
type GenericOut<T extends keyof NodeJS.WriteStream> = Pick<NodeJS.WriteStream, T>;

export interface GenericInOut<T, U> {
readonly stdin: T;
readonly stdout: U;
}

export type In = GenericIn<InNames>;
export type In = Pick<NodeJS.ReadStream, "once" | "pause" | "resume">;

export type InOut = GenericInOut<GenericIn<InNames>, GenericOut<"write">>;
export type InOut = GenericInOut<In, GenericOut<"write">>;

export type InMovableOut = GenericInOut<GenericIn<InNames>, GenericOut<"moveCursor" | "write">>;
export type InMovableOut = GenericInOut<In, GenericOut<"moveCursor" | "write">>;

0 comments on commit 12c2e3b

Please sign in to comment.