luau icon indicating copy to clipboard operation
luau copied to clipboard

Setting variables to methods from class types doesn't have the variables type defined as the type of the method

Open gaymeowing opened this issue 1 year ago • 1 comments

 -- Players is also inferred as any as of writing, but im assuming this is roblox's types not being defined correctly as Instance.new("Part") is -- inferred as Part and not any 
local Players = game:GetService("Players")
local GET_USERID_FROM_NAME_ASYNC = Players.GetUserIdFromNameAsync -- inferred as any in the new solver

GET_USERID_FROM_NAME_ASYNC("meow") -- no type error

gaymeowing avatar Aug 29 '24 00:08 gaymeowing

Huh, things are definitely better as of this writing, but we're still not quite doing the right thing:

Image

That should really be GET_USERID_FROM_NAME_ASYNC : (self: Players, userName: string) -> number, though at least we correctly error now.

hgoldstein avatar Jan 23 '25 22:01 hgoldstein

Closing as the original issue has been fixed.

Issue that @hgoldstein highlights is unrelated to Luau code and should be a separate issue even if it was.

vegorov-rbx avatar Feb 14 '25 16:02 vegorov-rbx