betterdisplaycli 0.1.16 → 0.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/Device.ts +8 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "betterdisplaycli",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "description": "TypeScript bindings for `betterdisplaycli`.",
5
5
  "author": "Lucas Garron <code@garron.net>",
6
6
  "license": "MIT",
package/src/Device.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  import { PrintableShellCommand } from "printable-shell-command";
2
2
  import { print, type QuietOption } from "./get";
3
3
 
4
+ type BOOLEAN_SETTING = "connected" | "hiDPI" | "notch";
5
+ type STRING_SETTING = "resolution";
6
+
4
7
  export type NumberString = string;
5
8
 
6
9
  export interface DeviceInfoCommon {
@@ -44,7 +47,7 @@ class SingleDisplay extends Device {
44
47
  }
45
48
  boolean = {
46
49
  get: async (
47
- settingName: "connected" | "hiDPI",
50
+ settingName: BOOLEAN_SETTING,
48
51
  options?: QuietOption,
49
52
  ): Promise<boolean> => {
50
53
  switch (
@@ -70,7 +73,7 @@ class SingleDisplay extends Device {
70
73
  },
71
74
 
72
75
  set: async (
73
- settingName: "connected" | "hiDPI",
76
+ settingName: BOOLEAN_SETTING,
74
77
  on: boolean,
75
78
  options?: QuietOption,
76
79
  ): Promise<void> => {
@@ -86,7 +89,7 @@ class SingleDisplay extends Device {
86
89
  },
87
90
 
88
91
  toggle: async (
89
- settingName: "connected" | "hiDPI",
92
+ settingName: BOOLEAN_SETTING,
90
93
  options?: QuietOption,
91
94
  ): Promise<void> => {
92
95
  await print(
@@ -102,7 +105,7 @@ class SingleDisplay extends Device {
102
105
  };
103
106
  string = {
104
107
  get: async (
105
- settingName: "resolution",
108
+ settingName: STRING_SETTING,
106
109
  options?: QuietOption,
107
110
  ): Promise<string> => {
108
111
  return print(
@@ -117,7 +120,7 @@ class SingleDisplay extends Device {
117
120
  },
118
121
 
119
122
  set: async (
120
- settingName: "resolution",
123
+ settingName: STRING_SETTING,
121
124
  value: string,
122
125
  options?: QuietOption,
123
126
  ): Promise<void> => {