-
-
Notifications
You must be signed in to change notification settings - Fork 166
/
index.test-d.ts
49 lines (44 loc) · 1.36 KB
/
index.test-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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import {expectType, expectError} from 'tsd';
import {
activeWindow,
activeWindowSync,
openWindows,
openWindowsSync,
type Result,
type LinuxResult,
type MacOSResult,
type WindowsResult,
BaseOwner,
} from './index.js';
expectType<Promise<Result | undefined>>(activeWindow());
const result = activeWindowSync({
screenRecordingPermission: false,
accessibilityPermission: false,
});
expectType<Result | undefined>(result);
if (result) {
expectType<'macos' | 'linux' | 'windows'>(result.platform);
expectType<string>(result.title);
expectType<number>(result.id);
expectType<number>(result.bounds.x);
expectType<number>(result.bounds.y);
expectType<number>(result.bounds.width);
expectType<number>(result.bounds.height);
expectType<string>(result.owner.name);
expectType<number>(result.owner.processId);
expectType<string>(result.owner.path);
expectType<number>(result.memoryUsage);
if (result.platform === 'macos') {
expectType<MacOSResult>(result);
expectType<string>(result.owner.bundleId);
expectType<string | undefined>(result.url);
} else if (result.platform === 'linux') {
expectType<LinuxResult>(result);
} else {
expectType<WindowsResult>(result);
expectType<number>(result.contentBounds.x);
expectType<number>(result.contentBounds.y);
expectType<number>(result.contentBounds.width);
expectType<number>(result.contentBounds.height);
}
}