Reproduction Steps
local x: string? = if condition then "" else nil
Expected Behavior
if expression should consider the type of what it is being assigned to or used in
Actual Behavior
It will always warn if the false value doesn’t fit within the true value’s type.
Workaround
Cast true value to a type that fits both
local x: string? = if condition then "" :: string? else nil
or use the old and…or if the true value isn’t falsy, which will give a union of both types
Issue Area: Studio
Issue Type: Other
Impact: Low
Frequency: Constantly