@kingdomsconnected/types 1.5.0

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 ADDED
@@ -0,0 +1,39 @@
1
+ # @kingdomsconnected/types
2
+
3
+ TypeScript declarations for the Kingdoms Connected scripting API, generated from the runtime's own
4
+ bindings and published with every release. The package version is the release version.
5
+
6
+ ```sh
7
+ pnpm add -D @kingdomsconnected/types
8
+ ```
9
+
10
+ A resource runs in the server's Node.js isolate or in a client's sandboxed V8 one, and the two
11
+ declare different globals -- the server's `Player` has the connection verbs, the client's does
12
+ not -- so they are two TypeScript programs, each naming its side in `types`:
13
+
14
+ ```jsonc
15
+ // tsconfig.json (server half)
16
+ {
17
+ "compilerOptions": {
18
+ "lib": ["ES2022"],
19
+ "types": ["@kingdomsconnected/types/server"]
20
+ }
21
+ }
22
+ ```
23
+
24
+ ```jsonc
25
+ // src/client/tsconfig.json (client half)
26
+ {
27
+ "compilerOptions": {
28
+ "lib": ["ES2022"],
29
+ "types": ["@kingdomsconnected/types/client"]
30
+ }
31
+ }
32
+ ```
33
+
34
+ Everything is declared as a global, as the runtime installs it: `Events`, `console`, the timers,
35
+ `Player`, `Vector3` and the rest need no import. The DOM library would declare a second
36
+ `setTimeout` and `console`, so leave it out of `lib`.
37
+
38
+ Install the version matching the server you deploy to; a newer package may declare bindings an
39
+ older server does not have.