-
Notifications
You must be signed in to change notification settings - Fork 455
Closed
Labels
bugSomething isn't workingSomething isn't workingnew solverThis issue is specific to the new solver.This issue is specific to the new solver.
Description
Consider this code:
--!strict
type WallHolder = {
__type: "Model",
Wall: {
__type: "BasePart",
age: number,
},
}
local walls = {
{ name = "Part1" },
{ name = "Part2" },
{ name = "Wall" },
}
local baseWall: WallHolder?
for _, wall in walls do
if wall.name == "Wall" then
baseWall = wall :: WallHolder
end
end
assert(baseWall, "Failed to get base wall when creating room props")
local myAge = baseWall.Wall.age
even though this code should be type safe, the last line has problems.
Specifically, baseWall
on the last line is recognized as:
local baseWall: {
Wall: {
__type: "BasePart",
age: number
},
... 1 more ...
}
which is good! baseWall.Wall
is also good:
{
__type: "BasePart",
age: number
}
however when we access baseWall.Wall.age
, we get never
!
This results in myAge
having the type never
, even though it should be number
.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingnew solverThis issue is specific to the new solver.This issue is specific to the new solver.