Declaring a type as an intersection of one type with another can result in impossible types being created when accepting this type as a parameter of a function.
This happens only in Studio with --!strict
.
I am unsure of when this issue started.
Repro
Create a script with the following code:
--!strict
type A = {}
type B = A&{
Value: string|boolean
}
local function C(self: B): nil
self.Value = true; --Typecheck error: "Type 'boolean' could not be converted into 'boolean & string'"
return;
end