rbxts-flamework / core

Flamework is an extensible game framework. It requires typescript and offers many useful features.
MIT License
112 stars 8 forks source link

Option to not generate client-side typechecking for remote events #75

Closed safazi closed 1 year ago

safazi commented 1 year ago

I know there is a parameter to bypass the type checking, but there should be an option to prevent the transformer from actually generating the types.

Fireboltofdeath commented 1 year ago

What's your use case?

safazi commented 1 year ago

I meant server->client remote functions, wrote the wrong thing. There should be an option for the transformer to not generate the return type checking - the client can trust that the server will return what it is supposed to.

Fireboltofdeath commented 1 year ago

I meant server->client remote functions, wrote the wrong thing. There should be an option for the transformer to not generate the return type checking - the client can trust that the server will return what it is supposed to.

Is there a reason disabling the guards isn't viable? For example, introducing a settings to disable only return validation (but is there a reason to only disable return validation)?

safazi commented 1 year ago

Messed up again. I meant client -> server remote function invocation. Disabling the return guard is entirely viable (and I do that), but the server returns a big interface, and I'd rather it just not generate return type checking at all, especially as the interface gets larger and more complicated.

Fireboltofdeath commented 1 year ago

Messed up again. I meant client -> server remote function invocation. Disabling the return guard is entirely viable (and I do that), but the server returns a big interface, and I'd rather it just not generate return type checking at all, especially as the interface gets larger and more complicated.

Is your issue for cosmetic reasons or are you having issues with the size of the interface?

safazi commented 1 year ago

Cosmetic and efficiency. I am of the opinion that the client does has no reason to validate the servers return data at all.

Fireboltofdeath commented 1 year ago

Cosmetic and efficiency. I am of the opinion that the client does has no reason to validate the servers return data at all.

If guards are disabled on the client, it won't ever try to validate anything from the server.

I will take note of the cosmetic issues but that'll likely be addressed by #74 which won't inline the type guards

Fireboltofdeath commented 1 year ago

I am going to close this issue for now, if you think #74 isn't ideal for your use case then you can reopen but I believe it would solve the cosmetic issues you are concerned with.