RaycastResult.Instance type is 'any' instead of 'BasePart'

I expect that RaycastResult.Instance will have the type of BasePart, or at least Instance as the name suggests. Instead, the type is any. You can see the issue in the code below.


Reproduction Steps

-- psuedo:
local result = workspace:Raycast(origin, direction, params)
if result then
    result.Instance. --> No autocomplete here
    result. --> Autocomplete for `RaycastResult` here
end

Expected Behavior

RaycastResult.Instance’s type is BasePart.

Actual Behavior

RaycastResult.Instance type is any.

Issue seen here:
image


Workarounds

Define Union Type

Assigning Variable

image


Date first experienced: 5/20/2023 (probably a long time ago too)
Date last experienced: 6/2/2023 (EST)

(edit: fix typos, change last experienced)

4 Likes

We’ve filed a ticket into our internal database for this issue, and we will update you when we have further information!

Thanks for the report!

3 Likes

May I include the fact the return type for Instance:FindFirstChild() is mismatched too? (supposed to be Instance? but its Instance)

1 Like

Any updates on this? This is still occuring for me.

1 Like

Would also like an update on this. Looks like a trivial fix.

1 Like

Still says the type is any even though the description suggests the perfect types it could be replaced with!

:grin:

3 Likes

A year later, and the type has only changed to Instance, and not BasePart… could somebody push this fix?