As of version 0.652, the methods in AssetService
for creating EditableImage/Mesh
objects aren’t marked as possibly returning nil, despite there being cases where they can at runtime (AssetService | Documentation - Roblox Creator Hub).
--!strict
local AssetService = game:GetService('AssetService')
local image = AssetService:CreateEditableImage()
local mesh = AssetService:CreateEditableMesh()
--these should throw type errors, but don't
image:Destroy()
mesh:Destroy()
Expected behavior
Taking AssetService.CreateEditableImage
for example, its return type should be EditableImage?
instead of EditableImage
so that type errors can be thrown in the event that the image fails to be allocated.