roblox-aurora / rbx-net

Advanced multi-language networking framework for Roblox
https://rbxnet.australis.dev/
MIT License
94 stars 13 forks source link

Troubles with luau types #82

Open lopi-py opened 1 year ago

lopi-py commented 1 year ago

[Edit]: Also lack of BidirectionalEvent, OnEvent and OnFunction

given this

--!strict
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Net = require(ReplicatedStorage.Packages.Net)

return Net.CreateDefinitions({
    Cuffs = Net.Definitions.Namespace({}), --> error here
})
TypeError: Type '{ Cuffs: {ClientAsyncFunctionDefinition | ClientToServerEventDefinition | ServerAsyncFunctionDefinition | ServerFunctionDefinition | ServerToClientEventDefinition} }' could not be converted into 'RemoteDefinitions'
caused by:
  Property 'Cuffs' is not compatible. Type 'ClientAsyncFunctionDefinition | ClientToServerEventDefinition | ServerAsyncFunctionDefinition | ServerFunctionDefinition | ServerToClientEventDefinition' could not be converted into '{ClientAsyncFunctionDefinition | ClientToServerEventDefinition | ServerAsyncFunctionDefinition | ServerFunctionDefinition | ServerToClientEventDefinition}'
caused by:
  Not all union options are compatible. Table type 'ServerToClientEventDefinition' not compatible with type '{ClientAsyncFunctionDefinition | ClientToServerEventDefinition | ServerAsyncFunctionDefinition | ServerFunctionDefinition | ServerToClientEventDefinition}' because the former has extra field '__nominal_ServerToClientEventDefinition'Luau[1000](https://luau-lang.org/typecheck)

currently using luau-lsp

lopi-py commented 1 year ago

@Vorlias any update on this?, I really like this module but it's so annoying to have huge errors every time I want to edit the remotes

Vorlias commented 1 year ago

Yeah, sorry been quite overloaded with stuff at the moment so haven't had as much time to look into things like this. Will try to look into this today.

Vorlias commented 1 year ago

Package updated - vorlias/net@3.0.4. Types should be fixed now.

Vorlias commented 1 year ago

I realised I missed adding BidirectionalEvent - will fix that at some point.

lopi-py commented 1 year ago

Ok thanks for fixing that, can't wait for bidirectional event fix 😄🤞