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

[BUG] Luau reports typechecking error on strict #43

Closed
Aloroid opened this issue Jan 1, 2024 · 1 comment · Fixed by #40
Closed

[BUG] Luau reports typechecking error on strict #43

Aloroid opened this issue Jan 1, 2024 · 1 comment · Fixed by #40
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Aloroid
Copy link

Aloroid commented Jan 1, 2024

Describe the bug

Luau currently reports a type error in strict mode for code generated for the client.
This is due to when using :WaitForChild, the return value is Instance while we know that it's a RemoteEvent.
The function FireServer does not exist on type Instance thus correctly reporting an error.

Reproduction

Just generate any code for the client. It should cause a type error in strict mode.

Expected behavior

The generated code should not give off any type error.

Potential Fix

Typecast the resulting return value to be RemoteEvent / UnreliableRemoteEvent

@Aloroid Aloroid added the bug Something isn't working label Jan 1, 2024
@ArchLand64
Copy link

I believe a better fix to this problem is to just assert the class of the instance received, because the instance received could actually be something other than a RemoteEvent. That looks like

assert(reliable:IsA("RemoteEvent"))
assert(unreliable:IsA("UnreliableRemoteEvent"))

@sasial-dev sasial-dev linked a pull request Jan 1, 2024 that will close this issue
@sasial-dev sasial-dev self-assigned this Jan 9, 2024
@sasial-dev sasial-dev added this to the 0.5 Release milestone Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants