@jest-com/types 1.260826.3 → 1.260827.14
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 +22 -12
- package/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,16 +13,31 @@ describes the global `JestSDK` object that script creates.
|
|
|
13
13
|
npm install --save-dev @jest-com/types
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
##
|
|
16
|
+
## Setup
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
TypeScript auto-loads types only from `node_modules/@types/*`, so name this
|
|
19
|
+
package in your `tsconfig.json`:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"compilerOptions": {
|
|
24
|
+
"types": ["vite/client", "@jest-com/types"]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
List every type package you rely on. A `types` array replaces TypeScript's
|
|
30
|
+
automatic inclusion, so anything left out of it stops being picked up.
|
|
31
|
+
|
|
32
|
+
To avoid managing that list, add a `.d.ts` under your source root instead. Vite
|
|
33
|
+
projects already have `src/vite-env.d.ts` for this:
|
|
19
34
|
|
|
20
35
|
```typescript
|
|
21
|
-
|
|
36
|
+
/// <reference types="vite/client" />
|
|
37
|
+
/// <reference types="@jest-com/types" />
|
|
22
38
|
```
|
|
23
39
|
|
|
24
|
-
|
|
25
|
-
every file, not just the one that imports:
|
|
40
|
+
Either way, `JestSDK` and `window.JestSDK` are typed globals in every file:
|
|
26
41
|
|
|
27
42
|
```typescript
|
|
28
43
|
await JestSDK.init();
|
|
@@ -30,15 +45,10 @@ await JestSDK.init();
|
|
|
30
45
|
const player = JestSDK.getPlayer();
|
|
31
46
|
```
|
|
32
47
|
|
|
33
|
-
|
|
34
|
-
nothing for it to import. Add a `.d.ts` file instead, for example
|
|
35
|
-
`src/jestsdk.d.ts`:
|
|
48
|
+
Named types are exported for your own signatures:
|
|
36
49
|
|
|
37
50
|
```typescript
|
|
38
|
-
|
|
51
|
+
import type { Jest, PlayerProfile, SubscriptionData } from "@jest-com/types";
|
|
39
52
|
```
|
|
40
53
|
|
|
41
|
-
TypeScript auto-loads types only from `node_modules/@types/*`, so one or the
|
|
42
|
-
other is needed.
|
|
43
|
-
|
|
44
54
|
Full docs: https://docs.jest.com/sdk/html5
|
package/index.d.ts
CHANGED