Incorrect type information for Blockcast, Spherecast, and Shapecast methods

The type information for Blockcast, Spherecast, and Shapecast methods are incorrect; they are suppose to return RaycastResult?, just like the Raycast method, but they claim to return RaycastResult.




This can lead to bugs in developers’ code due to the lack of acknowledgment that the methods may return nil.

5 Likes

I don’t think raycast is special here - in Studio it’s always non-optional RaycastResult. Do you have some custom tooling with special types?

Either way, we’ll change these all to RaycastResult?.

1 Like

I’m using Luau LSP by JohnnyMorganz, which uses the official Luau type checker, the same one that Roblox Studio uses. As for the Roblox types, I believe they come from the Roblox API dump.

This seems to be an issue with luau-lsp - They have the wrong types for shapecast etc. Feel free to file an issue for that project.

We’ll fix this in the Studio property dump and autocomplete, but that won’t help folks who are using this project until they update.

1 Like

This was a problem with the third-party luau-lsp, which has since fixed the issue. Any future discussion about their solution should be reported in their Github issues. Thanks!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.