Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to create ServerFunctions within namespaces #87

Open
synpixel opened this issue Apr 13, 2023 · 1 comment
Open

Unable to create ServerFunctions within namespaces #87

synpixel opened this issue Apr 13, 2023 · 1 comment

Comments

@synpixel
Copy link

synpixel commented Apr 13, 2023

I've noticed you cannot create ServerFunctions within namespaces. It'll throw a type error:

TypeError: Type '{ SpawnUnit: ServerFunctionDefinition }' could not be converted into '{| [string]: ClientAsyncFunctionDefinition | ClientToServerEventDefinition | ServerAsyncFunctionDefinition | ServerToClientEventDefinition |}'
caused by:
  Property 'SpawnUnit' is not compatible. Type 'ClientAsyncFunctionDefinition | ClientToServerEventDefinition | ServerAsyncFunctionDefinition | ServerToClientEventDefinition' could not be converted into 'ServerFunctionDefinition'
caused by:
  Not all union options are compatible. Table type 'ServerToClientEventDefinition' not compatible with type 'ServerFunctionDefinition' because the former has extra field '__nominal_ServerToClientEventDefinition'
@synpixel synpixel changed the title Unable to create ServerFunctions inside namespaces Unable to create ServerFunctions within namespaces Apr 13, 2023
@prepsure
Copy link

prepsure commented May 26, 2023

After tinkering around with this a bit, this is solely because of the luau type definitions, all the functionality is actually already there. All that needs to be done is to update the namespace definition here so that it has ServerFunctionDefinition.
https://github.com/roblox-aurora/rbx-net/blob/4f1db298dba3cc96d3a3b0cd0d1b396c43c4f351/luau/dist/init.lua#LL120C1-L124C37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants