CocaColaBear / types-ragemp-c

Rage:MP TypeScript type definition for Client-side
https://rage.mp/
MIT License
53 stars 60 forks source link

v2: mp.game v2 typings #88

Closed nutt3r closed 2 years ago

nutt3r commented 2 years ago

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

checkeredblast2914 commented 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.

checkeredblast2914 commented 2 years ago

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: Result

foola1 commented 2 years ago

How to test ?

nutt3r commented 2 years ago

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: 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
foola1 commented 2 years ago

It is working thanks

CocaColaBear commented 2 years ago

Good job, thanks