Remember to 🌟 this Github if you 💖 it.
This package contains types definitions for RAGE:MP server-side module.
📥 Installation
SERVER-SIDE
Use github:ragempcommunity/ragemp-types#types-server
to latest build
npm i --save-dev github:ragempcommunity/ragemp-types
yarn add -D github:ragempcommunity/ragemp-types
pnpm add -D github:ragempcommunity/ragemp-types
To make these types detectable, you need to add the types
property below to tsconfig.json
on each side of your project.
// e.g server-side
{
"compilerOptions": {
"types": ["{RELATIVE_PATH_TO_NODE_MODULES}/@ragemp/types-server"]
}
}
🤓 Usage
Full type-safe and auto-complete
To extend a Mp object, there are 2 ways:
- By extend the prototype of the object:
mp.Player.prototype.myMethod = function myMethod() {
};
mp.events.add('playerReady', (player) => {
player.myProperty = 1;
player.myMethod();
});
declare global {
interface PlayerMp {
myProperty: number;
myMethod(): void;
}
}
export {};
- By extend the object itself:
mp.events.add('playerReady', (player) => {
player.myProperty = 1;
player.myMethod = function myMethod() {
};
});
declare global {
interface PlayerMp {
myProperty: number;
myMethod(): void;
}
}
export {};
See: RAGEMP Typescript Boilerplate
👨💻 Contributing
To contribute to this repository, feel free to create a new fork of the repository and submit a pull request.
- Fork / Clone and select the
main
branch. - Create a new branch in your fork.
- Make your changes.
- Commit your changes, and push them.
- Submit a Pull Request here!
🎉 Thanks
📋 License
This project is licensed under the MIT License - see the LICENSE file for details.