foundry-vtt-types icon indicating copy to clipboard operation
foundry-vtt-types copied to clipboard

Fix logic for indeterminate nullable/required

Open LukeAbby opened this issue 1 year ago • 1 comments
trafficstars

When nullable: boolean users must assume that when getting null is a valid option as nullable may be true. When setting users must assume nullable may be false and therefore be an error. This means that indeterminate values for nullable must be treated differently in different contexts.

The same logic applies for required.

LukeAbby avatar Jul 07 '24 00:07 LukeAbby

If https://github.com/microsoft/TypeScript/issues/43826 were to be solved this could be perfectly done but I believe at the moment we probably have to be a bit overly conservative to prevent soundness holes.

Fortunately we can tell people to specify required/nullable exactly rather than indeterminately if they care.

LukeAbby avatar Jul 10 '24 11:07 LukeAbby