-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathtxt-reader-common.ts
41 lines (36 loc) · 925 Bytes
/
txt-reader-common.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
35
36
37
38
39
40
41
export interface IRequestMessage {
action: string;
data: any;
taskId: number;
}
export interface IResponseMessage {
success: boolean;
message: string;
result: any;
taskId: number;
done: boolean;
}
export interface IIteratorConfigMessage {
eachLine: string;
scope: object;
functionMap: string[];
}
export interface IGetSporadicLinesResult {
lineNumber: number;
value: string | Uint8Array;
}
interface ILinesRange {
start: number;
count?: number;
end?: number;
}
export type LinesRange = RequireOnlyOne<ILinesRange, 'count' | 'end'>;
export type SporadicLineItem = number | LinesRange;
export type SporadicLinesMap = (SporadicLineItem)[];
type RequireOnlyOne<T, Keys extends keyof T = keyof T> =
Pick<T, Exclude<keyof T, Keys>>
& {
[K in Keys]-?:
Required<Pick<T, K>>
& Partial<Record<Exclude<Keys, K>, undefined>>
}[Keys]