@hogwartsmp/types
v1.12.2
Published
TypeScript declarations for the ArcaneMP scripting API, one entry per side: @hogwartsmp/types/server and @hogwartsmp/types/client
Maintainers
Readme
@hogwartsmp/types
TypeScript declarations for the ArcaneMP scripting API, generated from the runtime's own bindings and published with every release. The package version is the release version.
pnpm add -D @hogwartsmp/typesA resource runs in the server's Node.js isolate or in a client's sandboxed V8 one, and the two
declare different globals -- the server's Player has the connection verbs, the client's does
not -- so they are two TypeScript programs, each naming its side in types:
// tsconfig.json (server half)
{
"compilerOptions": {
"lib": ["ES2022"],
"types": ["@hogwartsmp/types/server"]
}
}// src/client/tsconfig.json (client half)
{
"compilerOptions": {
"lib": ["ES2022"],
"types": ["@hogwartsmp/types/client"]
}
}Everything is declared as a global, as the runtime installs it: Events, console, the timers,
Player, Vector3 and the rest need no import. The DOM library would declare a second
setTimeout and console, so leave it out of lib.
Server resources run in Node.js and may use its modules. To type those, add @types/node and
"node" to the server half's types. Node's types declare their own console, so also set
skipLibCheck:
// tsconfig.json (server half, with Node's modules)
{
"compilerOptions": {
"lib": ["ES2022"],
"types": ["node", "@hogwartsmp/types/server"],
"skipLibCheck": true
}
}Builtins whose names start with an underscore are the runtime's internal probes and QA drivers, not API, and are left out.
Install the version matching the server you deploy to; a newer package may declare bindings an older server does not have.
