lolleko / gmod-typescript

Tool to generate typescript definitions for garrysmod.
MIT License
21 stars 8 forks source link

... functions expecting arrays #1

Closed Vurv78 closed 3 years ago

Vurv78 commented 3 years ago

Functions like print are generated as so right now:

declare function print(args: any[]): void;

They should be like this instead (as far as I know) Works for me when I manually changed it.

declare function print(...args: any[]): void;

Nice project dude, I was thinking of making this but then was pointed to this after they found it when I somehow couldn't..

Another Note: I think you're supposed to make all of these functions @noSelf because they're all passing nil as the first argument. https://typescripttolua.github.io/docs/the-self-parameter/

Vurv78 commented 3 years ago

Yeah, adding /** @noSelfInFile **/ under /// <reference path="./extras.d.ts" /> fixed nil being the first argument passed to every single function. I could PR this stuff myself but it'd take time.

lolleko commented 3 years ago

Hey, thanks for the issue. I recently upgraded the generator to use the new gmod wiki and the types still need some tweaking.

I will have a look, at fixing vararg and adding noselfinfile next week!

lolleko commented 3 years ago

@Vurv78 I published https://www.npmjs.com/package/gmod-types please let me know if that works for you. You are welcome to join our discord if you have further questions https://discord.gg/BWAq58Y

Vurv78 commented 3 years ago

@lolleko Yep, works perfectly, thanks 👍