Closed nutt3r closed 2 years ago
Thanks for your work. I test with few gamemodes and it works except optional parameters like you said. It is not big issue because I see another repo with code leaked from ragemp and those parameters in the check default to 0.
I see you add integer
type like ragemp definitions (shh.d.ts). This type is not displayed as integer in VS code but is number. It is same with Handle and Hash types because they are only simple aliases.
You could do type integer = number & {};
and then VS Code/tsc will write integer/Hash/Handle not number. Result:
How to test ?
I see you add
integer
type like ragemp definitions (shh.d.ts). This type is not displayed as integer in VS code but is number. It is same with Handle and Hash types because they are only simple aliases.You could do
type integer = number & {};
and then VS Code/tsc will write integer/Hash/Handle not number. Result:
Thanks, we will consider this.
How to test ? Uninstall existing definitions you might have and then install from our repo.
npm uninstall --save-dev @types/ragemp-c npm install --save-dev github:pursuits-mp/types-ragemp-c#gamev2
To revert back, you do the opposite.
npm uninstall --save-dev @types/ragemp-c
npm install --save-dev github:CocaColaBear/types-ragemp-c#v2.0
It is working thanks
Good job, thanks
Thanks to the type checking layer implemented in July 2021 for the new game native API, we have generated definitions for mp.game v2.
Included are more than 6,000 natives including new natives and natives missing from other available definitions.
These definitions mostly match the structure of the early definitions shared by RAGE:MP in July, but we have not been able to confirm 100%. The old definitions have not been removed yet because they are still accessible via
mp.game1
.In the future, we will be able to update these definitions and also provide a changelog once we detect an update of the natives API.
We have conducted random testing of natives and so far all have matched correctly. But this should be tested against existing scripts, especially for the following issues.
Issues
Optional Parameters are not detected. We have detected a number of natives where this may cause errors during TypeScript type checking for existing scripts. An example is
mp.game.cam.renderScriptCams(...)
. A lot of scripts will assume this has 5 parameters, but it actually has 6 parameters since mp.game v2. The early definitions shared by RAGE:MP in July also did not support optional parameters so it could be best for server developers to fix these issues themselves or switch to gamev1 (mp.game1.cam.renderScriptCams).Native reference results may be incorrect for a few natives. I believe we have fixed this issue in our generator but it's best to double-check things like pathfinding natives.