electron-types 0.0.1 → 40.0.0-beta.3

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.
package/README.md CHANGED
@@ -8,32 +8,50 @@ The official `electron` package is ~200MB because it includes the Electron binar
8
8
 
9
9
  ## Installation
10
10
 
11
- Since this package only provides TypeScript types, install it as a dev dependency:
11
+ Since this package only provides TypeScript types, install it as a dev dependency. **Install the version that matches your Electron version** (see [Version Matching](#version-matching)):
12
12
 
13
13
  ```bash
14
- npm install -D electron-types
14
+ # Replace X.Y.Z with your Electron version (e.g., 39.2.7)
15
+ npm install -D electron-types@X.Y.Z
15
16
  # or
16
- yarn add -D electron-types
17
+ yarn add -D electron-types@X.Y.Z
17
18
  # or
18
- pnpm add -D electron-types
19
+ pnpm add -D electron-types@X.Y.Z
20
+ ```
21
+
22
+ You can also use semver ranges to stay compatible with your Electron version:
23
+
24
+ ```bash
25
+ # Match any 39.x.x version
26
+ npm install -D electron-types@^39.0.0
27
+
28
+ # Match any 39.2.x version
29
+ npm install -D electron-types@~39.2.0
30
+ ```
31
+
32
+ Or install without a version to get the latest:
33
+
34
+ ```bash
35
+ npm install -D electron-types
19
36
  ```
20
37
 
21
38
  ## Usage
22
39
 
23
- The types are available via the `Electron` namespace:
40
+ Add `electron-types` to your `tsconfig.json`:
24
41
 
25
- ```typescript
26
- // Types are available via the Electron namespace
27
- const win: Electron.BrowserWindow = /* ... */;
28
- const app: Electron.App = /* ... */;
42
+ ```json
43
+ {
44
+ "compilerOptions": {
45
+ "types": ["electron-types"]
46
+ }
47
+ }
29
48
  ```
30
49
 
31
- For projects that need to reference the types in a `.d.ts` file:
50
+ Then use the `Electron` namespace in your code:
32
51
 
33
52
  ```typescript
34
- /// <reference types="electron-types" />
35
-
36
- declare const myWindow: Electron.BrowserWindow;
53
+ const win: Electron.BrowserWindow = /* ... */;
54
+ const app: Electron.App = /* ... */;
37
55
  ```
38
56
 
39
57
  ## Version Matching