@ghostmp/ts
v0.1.0
Published
TypeScript declarations for Ghost Multiplayer — client (mp.game natives, UI) and server (mp.players, mp.world) APIs.
Downloads
43
Maintainers
Readme
@ghostmp/ts
TypeScript declarations for Ghost Multiplayer scripts. Pure .d.ts — no runtime code.
Split by side (same idea as @ragempcommunity/types-client / types-server):
| Subpath | Use in | mp API |
|---------|--------|----------|
| @ghostmp/ts/client | client scripts (server/client/) | mp.game.*, mp.keys, mp.player, mp.gui, mp.cef |
| @ghostmp/ts/server | server scripts (server/) | mp.players, mp.world, events |
Install
npm install --save-dev @ghostmp/tsJavaScript (JSDoc)
/// <reference types="@ghostmp/ts/client" />
mp.events.add('resourceStart', async () => {
const ped = await mp.game.player.playerPedId();
mp.gui.chat.push(`ped=${ped}`);
});/// <reference types="@ghostmp/ts/server" />
mp.events.add('playerJoin', (player) => {
player.outputChatBox(`Welcome ${player.name}`);
});TypeScript
// client tsconfig.json
{
"compilerOptions": {
"types": ["@ghostmp/ts/client"]
}
}// server tsconfig.json
{
"compilerOptions": {
"types": ["@ghostmp/ts/server"]
}
}Publish (maintainers)
Source of truth for declarations lives in types/ at repo root. Before publishing:
cd ts_lib
npm run sync
npm publishmp.game.d.ts is regenerated by node tools/gen_ts_types.mjs (also synced into ts_lib/client/).
